我正试着在我自己的CMS中设置原理2。我把Doctrince文件夹放到了/var/www/html/mysite.com/,'index.php‘和'config.php’都在这里。
我的config.php点赞如下:
<?php
ini_set("display_errors",true);
date_default_timezone_set("Asia/Ho_Chi_Minh");
define('TIMER_START', microtime( true ) );
define( 'DS', DIRECTORY_SEPARATOR );
define( 'ROOT_DIR', realpath( dirname( __FILE__ ) ) . DS );
define('MNGDIR', ROOT_DIR.'manager'.DS );
define('HDLDIR' , ROOT_DIR.'handler'.DS );
define('TPLDIR', ROOT_DIR.'template'.DS );
define('MDLDIR', ROOT_DIR.'model'.DS );
define('L2J', ROOT_DIR.'l2j'.DS );
define('DBN', '####' );
define('USR', '####' );
define('PWD','####');
use Doctrince\ORM\Tools\Setup;
use Doctrince\ORM\EntityManager;
$paths = array("/path/to/entity-files");
$isDevMode = false;
// the connection configuration
$dbParams = array(
'driver' => 'pdo_mysql',
'user' => USR,
'password' => PWD,
'dbname' => DBN,
);
$config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode);
$entityManager = EntityManager::create($dbParams, $config);
/*function exceptionHandler($exception){
error_log($exception->getMessage());
}
set_error_handler("exceptionHandler");*/
?>我检查了很多次,以确保Doctrince\ORM\Tools\Setup.php存在,也检查了setup.php中的命名空间Doctrince是否存在。然而,我仍然得到这样的错误:
Fatal error: Class 'Doctrince\ORM\Tools\Setup' not found in /var/www/html/mysite.com/public_html/config.php on line 0我真的不知道为什么。即使我注释了Doctrince\ORM\Tools\Setup,下一行仍然是work。请帮帮忙。谢谢。
发布于 2016-10-13 18:33:19
我真的不知道,我试着通过Composer和我使用的Composer.json再次下载why.But:
{
"require": {
"Doctrine/ORM": "2.3.3"
},
"autoload": {
"psr-0": {"MyProject\\Models\\": "src/models/"}
}
}而且mySite运行得很顺利。我从this link那里得到了那个json文件。为什么我们不能只使用ORM,只使用ORM,而不能使用autoloading?
https://stackoverflow.com/questions/40017256
复制相似问题