codeigniter MY_Controller not found

后端 未结 5 408
误落风尘
误落风尘 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 12:01

    in config/config.php

    /* load class in core folder */
    function my_load($class) {        
    
        if (strpos($class, 'CI_') !== 0) {            
            if (is_readable(APPPATH . 'core' . DIRECTORY_SEPARATOR . $class . '.php' )) {                
                require_once (APPPATH . 'core' . DIRECTORY_SEPARATOR . $class . '.php');                
            }
        }
    
    }
    
    spl_autoload_register('my_load');
    

提交回复
热议问题