我创建了一个核心控制器名为Role_Admin
并设置配置前缀定制内核控制器
$config['subclass_prefix'] = 'Role_';
下面是Role_Admin.php
在core
文件夹
class Role_Admin extends CI_Controller {
function __construct() {
}
}
在控制器文件夹时,该代码我写
class admin extends Role_Admin { ... }
我得到
Fatal error: Class 'Role_Admin' not found
我在做什么是错的。
编辑:(我创建了一个快速解决方案是更好的,任何新的核心文件,您只创建扩展MY_Controller然后在您的控制器目录,你可以扩展您创建
class MY_Controller extends CI_Controller {
function __construct() {
parent::__construct();
//include custom core classes
$core_path = DOCUMENT_ROOT . '/application/core';
$this->load->helper('file');
foreach(get_filenames($core_path) as $file) {
if ($file != 'MY_Controller.php') {
if(file_exists($file)) {
include_once($file);
}
}
}
}
}
你把这个控制器和你使用的是哪个版本? –
您已将'Role_Admin.php'保存在'application/core /'中,而不是'system/core /'中,对吗? – air4x
air4x,yes .... reheel我正在使用最新的截至目前 –