我正在尝试创建Configuration
:
$config = new \Doctrine\ORM\Configuration;
虽然我可以在Zend Studio中使用Open declaration
看到这个类,但在浏览器中运行它会导致:
Fatal error: Class 'Doctrine\ORM\Configuration' not found in C:\Program Files\Zend\Apache2\htdocs\MyProject\library\Custom\Entitymanager.php on line 20
答案 0 :(得分:2)
确保doctrine在include路径中,并且你在application.ini文件中有autoloadernamespaces [] =“Doctrine”
答案 1 :(得分:2)
Doctrine有一个很好的自动加载器:
require '/path/to/libraries/Doctrine/Common/ClassLoader.php';
$classLoader = new \Doctrine\Common\ClassLoader('Doctrine', '/path/to/libraries');
$classLoader->register(); // register on SPL autoload stack
另见类似问题: