Codeigniter 版本 3.0.0 BUG?
Codeigniter Version 3.0.0 BUG?
我在 application/core 文件夹中创建了一个扩展 CI_Controller 的 MY_Controller.php 并创建了一个 Public_Controller.php 在同一文件夹中扩展了 MY_Controller
我创建了一个扩展 MY_Controller 的 User.php 控制器,这很好用,但是当我更改用户控制器以扩展 Public_Controller 时,我收到了这个错误
Severity: Error
Message: Class 'Public_Controller' not found
这是一个错误吗?
codeigniter 3.0.0 版中是否还有其他众所周知的错误
不,这不是一个错误...它不会神奇地包括你的 Public_Controller.php 只是因为你把它放在那里。您必须手动包含该文件,最好是从 MY_Controller.php.
中
先生,我解决了这个问题:
我在 application/config/config.php
中添加了这段代码
function __autoload($classname){
if(strpos($classname, 'CI_')!==0){
$file = APPPATH.'core/'.$classname.'.php';
if(file_exists($file)&& is_file($file)){
@include_once($file);
}
}
}
我在 application/core 文件夹中创建了一个扩展 CI_Controller 的 MY_Controller.php 并创建了一个 Public_Controller.php 在同一文件夹中扩展了 MY_Controller
我创建了一个扩展 MY_Controller 的 User.php 控制器,这很好用,但是当我更改用户控制器以扩展 Public_Controller 时,我收到了这个错误
Severity: Error
Message: Class 'Public_Controller' not found
这是一个错误吗?
codeigniter 3.0.0 版中是否还有其他众所周知的错误
不,这不是一个错误...它不会神奇地包括你的 Public_Controller.php 只是因为你把它放在那里。您必须手动包含该文件,最好是从 MY_Controller.php.
中先生,我解决了这个问题: 我在 application/config/config.php
中添加了这段代码function __autoload($classname){
if(strpos($classname, 'CI_')!==0){
$file = APPPATH.'core/'.$classname.'.php';
if(file_exists($file)&& is_file($file)){
@include_once($file);
}
}
}