Код: Выделить всё
//Class file
namespace Company\Common;
class DB {
private function __construct(){
$this->Handle=new PDO(...);
}
}
Код: Выделить всё
Warning: require(...\vendors\Company\Common\PDO.class.php): failed to open stream
Код: Выделить всё
namespace Company\Common;
use PDO;
Код: Выделить всё
Fatal error: Class 'DB' not found in ...\includes\utils.php
Код: Выделить всё
DB::getInstance();
Код: Выделить всё
namespace Company\Common;
class DB {
private function __construct(){
$this->Handle=new \PDO(...);
}
}
Как я могу решить эту проблему ? Я думал, что использование PDO или new \PDO загрузит глобальный класс PDO, но, похоже, он не работает?
Подробнее здесь: https://stackoverflow.com/questions/142 ... -namespace