在index.php中,我保留了从lib文件夹加载类的__autoload()函数。
function __autoload($class) {
if(file_exists(LIBS . $class .".php")){
require LIBS . $class .".php";
}
}我有仪表板课
class Dashboard extends Controller {
public function __construct(){
Auth::handleLogin();
}
}使用sudo apache2在Ubuntu12.04上安装php5和apache2,我无法自动安装8月,有什么可能出错呢?它在我使用Bitnami服务器的另一台计算机上工作。
这是我得到的错误:
Fatal error: Class 'Auth' not found in /var/www/app/controllers/dashboard.php on line 6其中调用Auth::handleLogin();。
发布于 2014-02-23 21:26:35
这是因为在linux中,文件系统路径是区分大小写的。
发布于 2014-02-23 21:21:40
我有linux 16,当我做对象声明时,我使用这个名称空间,并且它工作得很完美。
spl_autoload_register(function ($class) {
$class = str_replace("\\", "/", $class);
include $class . '.php';
});索引文件
require_once 'autoload.php';
$db = new DBWork\DBWork('localhost', 'northwind', 'root', '123');https://stackoverflow.com/questions/21974638
复制相似问题