我正在处理我的库文件,但目前它只能获取文件夹中的控制器文件。我需要它能够拿起控制器是否在子文件夹
库文件
function controller($file_name){
$CI = & get_instance();$file_path = APPPATH.'controllers/'.$file_name.'.php';
$object_name = $file_name;
$class_name = ucfirst($file_name);if(file_exists($file_path)){
require $file_path;
$CI->$object_name = new $class_name();
} else {
show_error('Unable to load the requested controller class:'.$class_name);
}
}
实施例 控制器
public function __construct() {
parent::__construct();
$this->load->library('action');
$this->load->controller('header'); <--works
$this->load->controller('common/header'); <-- Not Working Not Picking up the subfolder header is file.
}