php – codeigniter 初學筆記
[自定config/的方法]
//建立一個自己取名的檔案名稱,例如config/custom.php $config['custom']['FB_APPID'] = "123"; $config['custom']['FB_APPSEC'] = "456"; //若要全域使用就去config/autoload.php修改: $autoload['config'] = array('custom'); //$autoload['config']後方的array為你要自動加載的名稱, 可參考他上方的英文解釋 //接著我們自定函數就這麼寫吧 $custom = $this->config->config['custom']; foreach ($custom as $key => $val) define($key, $val); //這樣就能把 $config['custom']的所有陣列自動定義為常數了