APPPATH不挑选子目录Codeigniter

时间:2014-01-20 15:50:24

标签: php codeigniter

我正在处理我的库文件,但目前它只能获取文件夹中的控制器文件。我需要它能够拿起控制器是否在子文件夹

库文件

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.
 }

0 个答案:

没有答案