Bonjours,

je débute avec php et PDO et j'arrive pas a identifier l'erreur
Error suppression ignored for
Class 'blog\app\Database' not found in C:\wamp\www\blog\page\home.php on line 3
je comprend pas pourtant le fichier existe un peu d'aide svp merci a vous
voici mes fichier .php

fichier home.php
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
<?php
 
$db=new app\Database('blog');
$datas=$db->query('SELECT * FROM article');
var_dump($datas);
fichier databse.php
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
 
<?php 
 
namespace app;
use \PDO;
 
class  Database {
 
privete $db_name;
privete $db_user;
privete $db_passe;
privete $db_host;
private $pdo;
public function __construct($db_name,$db_user='root',$db_passe='',$db_host='Localhost'){
 
$this->$db_name=$db_name;
$this->$$db_user=$d$db_user;
$this->$db_passe=$db_passe;
$this->$db_host=$db_host;
}
private function getpdo(){
$pdo = new PDO('mysql:dbname=blog; host=localhost','root','');
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$this->pdo=$pdo;
return $pdo;
 
}
puclic query($statement){
 
$req=getpdo()->query('$statement');
$datas=$req->fetchAll(PDO::FETCH_OBJ);
return $datas;
 
}
}
?>
fichier autoloead.php
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 
<?php
namespace app;
class Autoloader{
 
    /**
     * Enregistre notre autoloader
     */
    static function register(){
        spl_autoload_register(array(__CLASS__, 'autoload'));
    }
 
    /**
     * Inclue le fichier correspondant à notre classe
     * @param $class string Le nom de la classe à charger
     */
    static function autoload($class){
        if(strpos($class, __NAMESPACE__ . '\\')==0){
 
            $class = str_replace(__NAMESPACE__ . '\\',"", $class);
 
            $class = str_replace('\\','/', $class);
        }
 
        require __DIR__.'/' . $class . '.php';
    }
 
}
 
?>