PHP namespace PDO not found

后端 未结 2 1349
青春惊慌失措
青春惊慌失措 2020-12-31 06:25

I\'m facing an issue I unfortunatly could not resolve so far. I created a database class into app/db/mysql/database.php with the following content

2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-12-31 06:56

    Question was already edited, but for people who are just heading straight over to the answers, here it is..

    You should be using correct namespaces for the objects in your methods, either "use" them or prefix them with the root namespace;

    or simply;

    self::$connection = new \PDO("mysql:host=$host;dbname=$base", $user, $pass);
    

提交回复
热议问题