1. 程式人生 > >當我載入配置檔案時報錯:Call to undefined method CI_Config::config()

當我載入配置檔案時報錯:Call to undefined method CI_Config::config()

CI框架中,平時都用$this->config->config()  來載入配置檔案,當我新增新的配置資訊時,使用報錯。

關於以上錯誤,只需用$this->config->item()載入配置項即可。

那就好好整理下關於配置過程:

CI框架的配置資訊被儲存在$config陣列中,可以新增自己的配置資訊 或者 配置檔案到$config
使用配置檔案(方法一)$this->config->load('filename');//載入配置檔案
      $this->config->item('xxx');//獲取配置資訊

使用配置檔案(方法二)    在config資料夾中的autoload.php中設定預設載入。