/*| -------------------------------------------------------------------| Auto-load Config files| -------------------------------------------------------------------| Prototype:||$autoload['config'] = array('config1', 'config2');|| NOTE: This item is intended for use ONLY if you have created custom| config files. Otherwise, leave it blank.|*///我是這樣配置的$autoload['config'] = array('routes');
報錯如下:Your /var/www/config/routes.php file does not appear to contain a valid configuration array.
百思不得其解撒
回複討論(解決方案)
在自訂設定檔中需要注意的一點就是,你所有的配置資料都 需要放到全域的組態變數$config中。
載入自訂配置的這個方法,非要在自訂設定檔中找到$config這個變數才罷休,否則就是不合法的。
例如你的 routes.php
有一下配置
$routes = array(
'a' => 1,
'b' => 2
);
在 routes.php 中加入
$config['routes'] = $routes;
參考: http://coderaladdin.com/config-class-in-codeigniter/
Your /var/www/config/routes.php file does not appear to contain a valid configuration array.
routes.php 中沒有包含有效配置數組
你的 routes.php 中都是些什麼呢?
把你的 routes.php 黏貼過來看看
在自訂設定檔中需要注意的一點就是,你所有的配置資料都 需要放到全域的組態變數$config中。
載入自訂配置的這個方法,非要在自訂設定檔中找到$config這個變數才罷休,否則就是不合法的。
感謝,這個資料其實之前看過,當時沒弄懂,現在懂了
也就是說,必須要在被自動載入的設定檔中加上一句:
$config['自訂名稱'] = $組態變數;