|
发表于 2015-5-18 12:22:51
|
显示全部楼层
我也出现这种情况,URL有设置参数是正常 如:indxe.php?c=Welcome;要是未设置参数 如直接访问index.php默认的控制器没有生效,显示:
Unable to determine what should be displayed. A default route has not been specified in the routing file
最后查看代代码发现在system\core\Router.php中未给$this->default_controller赋值,获取不到默认的控制器。
解决办法:
在Function _set_routing()内将下面的代码提前放到这个函数内的前面:
// 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;
} |
|