codeigniter MY_Controller not found

后端 未结 5 509
误落风尘
误落风尘 2021-01-02 10:58

i’m using the Codeigniter.2.1.3 for a website, so i need to extend the CI_Controller so i can add a method to be executed with all controllers so i did what’s in the user_gu

5条回答
  •  长发绾君心
    2021-01-02 11:41

    You would need to include your MY_Controller class or auto-load it. I suggest you auto-load it by adding the following to your application/config/config.php file.

    function __autoload($class)
    {
        if (strpos($class, 'CI_') !== 0)
        {
            if (file_exists($file = APPPATH . 'core/' . $class . EXT))
            {
                include $file;
            }
        }
    } 
    

提交回复
热议问题