|
CI3.0
config.php 里的设置:
$config['enable_query_strings'] = TRUE;
的时候,routes.php里的:
$route['default_controller'] = 'Information/page_missing';
$route['404_override'] = 'Information/page_missing';
均不生效,
查找到源码:
system/core/Route.php 里的 _set_routing() 方法,发现:
if ($this->enable_query_strings) 的时候,没有加载:routes.php文件,解决办法,将下面代码从中间挪到方法最开始位置:
// Load the routes.php file.
if (file_exists(APPPATH.'config/routes.php'))
{
include(APPPATH.'config/routes.php');
}
if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/routes.php'))
{
include(APPPATH.'config/'.ENVIRONMENT.'/routes.php');
}
// Validate & get reserved routes
if (isset($route) && is_array($route))
{
isset($route['default_controller']) && $this->default_controller = $route['default_controller'];
isset($route['translate_uri_dashes']) && $this->translate_uri_dashes = $route['translate_uri_dashes'];
unset($route['default_controller'], $route['translate_uri_dashes']);
$this->routes = $route;
}
|
|