当开查询字符串的时候,参数enable_query_strings 为 true 。首页报错

An Error Was Encountered
Unable to determine what should be displayed. A default route has not been specified in the routing file.

解决办地,修改文件 system/core/Router.php

_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;
    }
版权声明:本文为李维亮博主的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:http://www.liweiliang.com/387.html

标签: ci3.0 默认路由问题 解决办法

评论已关闭