我做了很多的搜索我的問題,但我沒有得到任何東西..得到配置文件全陣列笨
在笨,當我使用的配置文件我做到這一點:
my_config.php :
$config['my_title'] = ' My Title Here ' ;
$config['color'] = ' red ' ;
我可以這樣獲取:
$this->load->config('my_config', TRUE);
$data['my_title'] = $this->config->item('my_title', 'my_config');
我的問題是:如何能我得到完整的陣列來處理它?
我想$配置與數組做這樣的事情:
foreach($config as $key=>$val){
$data[$key] = $val ;
}
所以我沒有寫我的所有變量,在配置文件中是這樣的:
$data['my_title'] = $this->config->item('my_title', 'my_config');
$data['color'] = $this->config->item('color', 'my_config');
和等等..
對不起我的英文破碎!
在此先感謝;)
非常感謝你約瑟夫,但是這給了我主要config.php中的數據..我想使用我的自定義文件(my_config.php)中的數據?再次感謝(我試圖自己現在得到它) – Ahmad
啊哈,對不起約瑟夫我沒有注意到..我得到的所有數據,在config.php和my_config.php ..現在非常好,再次感謝: ) – Ahmad
需要注意的是,如果你想要一個特定的配置文件,你應該這樣做:'$ redis = $ this-> config-> config ['redis']' –