我正在尝试在实时服务器上运行我的脚本,但它正在暂存。
在本地,一切都很好(OS X),远程,CentOS/Nginx,我遇到了一个致命的问题。脚本说找不到我的自定义数据库类。
查看加载的内容,使用get_declared_classes()
,我绝对可以看到我的自定义数据库类,该类在调用它的脚本/类之前加载。
它正在通过我的自动加载器加载:
spl_autoload_register(function ($className) {
if (file_exists(ROOT . DS . 'library' . DS . 'intranet' .DS . 'classes' . DS .strtolower($className) . '.php')){
require_once(ROOT . DS . 'library' . DS . 'intranet' .DS . 'classes' . DS .strtolower($className) . '.php');
} else if (file_exists(ROOT . DS . 'application' . DS . 'controller' . DS . strtolower($className) . '.php')) {
require_once(ROOT . DS . 'application' . DS . 'controller' . DS . strtolower($className) . '.php');
} else if (file_exists(ROOT . DS . 'application' . DS . 'model' . DS . strtolower($className) . '.php')) {
require_once(ROOT . DS . 'application' . DS . 'model' . DS . strtolower($className) . '.php');
} else if (file_exists(ROOT . DS . 'application' . DS . 'view' . DS . strtolower($className) . '.php')) {
require_once(ROOT . DS . 'application' . DS . 'view' . DS . strtolower($className) . '.php');
} else {
throw new Exception("Class: $className not autoloaded!");
}
});
没有异常被抛出。
Array ( [128] => Router
[129] => debug
[130] => database
[131] => SessionManager
[132] => security
)
Fatal error: Class 'database' not found in
/home/nginx/domains/ckrisc/public/library/intranet/classes/sessionmanager.php
on line 76
引导和文件包含如下:
require_once (ROOT . DS . 'config' . DS . 'config.php' );
require_once (ROOT . DS . 'config' . DS . 'directories.config.php' );
require_once (library . DS . 'setup.php' );
require_once (library . DS . 'Autoloader.php' );
require_once (library . DS . 'Router.php' );
require_once (library . DS . 'init.php' );
在这种情况下,该类database
是从 sessionmanager 调用的,它在 init.php
.
脚本在这里失败:
$sessionId = database::getInstance()->real_escape_string($sessionId);
关于我在这里缺少什么的任何想法?