自定义模板位置
在application/core中创建一个文件 CH_Controller.php 继承于 CI_Controllerabstract class CH_Controller extends CI_Controller{
function __construct(){
parent::__construct();
$this->load->_ci_view_path = FCPATH . 'templates/default/';//设置现在模板的位置
}
}
在 config.php 中
$config['subclass_prefix'] = 'CH_';
写控制器时继承
class GetConfig extends CH_Controller{
function index(){
$this->config->load('blog_setings',TRUE);
echo $this->config->item('name','blog_setings');
echo $this->config->item('language');
$data['userinfo'] = array('name'=>'chen jian ping','sex'=>'men','age'=>29);
$this->load->view('getconfig', $data);
}
} 有问题吗。。行吗。 2.1.0之前的版本可以,2.1.0这样不可以,要改一下 :'( 要怎么改啊
页:
[1]