ci框架子类继承父类时,报错Fatal error: Class ‘BaseController‘ not found in C:\xampp\htdocs

ci框架子类继承父类时,报错Fatal error: Class ‘BaseController‘ not found in C:\xampp\htdocs

 

i have created a controller menus.php which extends basecontroller as follows

<?php
class Menus extends BaseController {
    function __construct()
    {
        parent::__construct();

    }
}
?>

and BaseController.php in application/core folder as follows

<?php
class BaseController extends CI_Controller {
    function __construct()
    {
        parent::__construct();
    }
}
?>

I m getting error as Fatal error: Class 'BaseController' not found in

The class file name must begin with "MY_" unless you've changed it in config.php.

$config['subclass_prefix'] = 'MY_';

https://ellislab.com/codeIgniter/user-guide/general/core_classes.html

ci框架子类继承父类时,报错Fatal error: Class ‘BaseController‘ not found in C:\xampp\htdocsci框架子类继承父类时,报错Fatal error: Class ‘BaseController‘ not found in C:\xampp\htdocs

 

修改config.php文件中$config['subclass_prefix'] = 'MY_'; 这个配置就OK

参考:https://*.com/questions/28698521/fatal-error-class-basecontroller-not-found-in-c-xampp-htdocs

https://*.com/questions/33431597/class-basecontroller-not-found

 

 

上一篇:SQL中char、varchar、nvarchar的区别


下一篇:Yii2-自适应切换模板