index.php中隐藏掉的$assign_to_config是否这么使用
本帖最后由 actionbi 于 2012-4-2 19:03 编辑如题:
index.php入口文件的108-124行注释掉了,$assign_to_config数组,可是看英文意思的意思貌似是可以定制controller的配置
所以测试了下,能实现。
关键是不知道是不是这么用的。因为我定义$assign_to_config数组是在controller的构造函数里面。???
贴代码:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Assign_to_config extends CI_Controller{
/*
* @todo Test for assign_to_config ,which appeared on index.php
* @author ActionBi
* @time 2012/04/01
*
*/
function __construct(){
parent::__construct();
$assign_to_config['new_item1'] = 'value of item1';
$assign_to_config['new_item2'] = 'value of item2';
$this->config->_assign_to_config($assign_to_config);
}
function index(){
$data['item1'] = $this->config->item('new_item1');
$data['item2'] = $this->config->item('new_item2');
$data['base_url'] = $this->config->item('base_url'); //随意比较,看能不能取出来
$this->load->view('assign_to_config',$data);
}
};
?>
页:
[1]