php spl_autoload没有加载类

时间:2014-06-09 10:31:58

标签: php autoload

我遇到一个奇怪的问题,当我在Windows系统中测试它时,下面的函数工作正常,但是当我在Ubuntu 12.04中使用它时,相同的函数无法加载类。

在我的函数中,注释 include 加载函数,但 spl_autoload()不会加载该类。我很困惑可能是什么原因。

public function controller($class)
{
    $class = preg_replace('/Controller$/ui','',$class);
    ini_get('include_path');
    set_include_path(CONTROLLER_DIR.lcfirst($class).DIRECTORY_SEPARATOR);
    spl_autoload_extensions('Controller.php');
    #include(get_include_path().$class.spl_autoload_extensions()); # <-----This works fine
    spl_autoload($class); # <----but this is not loading the class
}

有什么想法吗?..

0 个答案:

没有答案
相关问题