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;
} 我在linux下面测试了,必须class首字母大写,切文件名与class一样首字母也要大写,举个例子,一个Welcome的类,如果你文件名是welcome而类名是Welcome这样是访问不到这个控制器的必须同时两个都是Welcome才可以
页:
1
[2]