0

我在 config.php 中添加了以下代码段之一:

 /*
| -------------------------------------------------------------------
|  Native Autoload - by Phil Sturgeon. New Version!
| -------------------------------------------------------------------
|
| Nothing to do with config/autoload.php, this allows PHP autoload to work
| for base controllers and some third-party libraries.
|
| If using HMVC you do not need this! HMVC will autoload.
|
| Place this code at the bottom of your application/config/config.php file.
*/
function __autoload($class)
{
    if (strpos($class, 'CI_') !== 0)
    {
        if (file_exists($file = APPPATH . 'core/' . $class . 'php'))
        {
            include $file;
        }
        elseif (file_exists($file = APPPATH . 'libraries/' . $class . 'php'))
        {
            include $file;
        }
    }
} 

出于某种原因,我发现我的虚拟主机抛出了一个错误;上面的代码只适用于我的本地主机 xampp!

当我从远程 Web 主机运行我的页面时,我收到此错误:

Fatal error: Class 'Frontend_Controller' not found in ....***some path***..../ci_centric/application/controllers/home.php on line 16

路径:

Frontend_Controller 扩展了 MY_Controller

MY_Controller 位于核心中,Frontend_Controller 位于库中

家庭控制器扩展了 Frontend_Controller

想知道为什么它在我的网络主机中不起作用,但在 localhost 中却可以正常工作!我需要编辑 php.ini 吗?请指教。

远程 web 主机具有 PHP 版本 5.2.*

4

0 回答 0