您好,欢迎访问一九零五行业门户网

ci 3.0有谁在用,自动加载配置文件貌似有问题啊

/*| -------------------------------------------------------------------| 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['自定义名称'] = $配置变量;
其它类似信息

推荐信息