找回密码
 立即注册

QQ登录

只需一步,快速开始

CodeIgniter 3.0 $config['enable_query_strings'] = true; 默认路由失效解决方案

crx349 于 2015-10-22 02:11 [CodeIgniter] 发表在 [复制链接] [显示全部楼层] [打印] [上一主题] [下一主题]
当config.php设置为:
  1. $config['enable_query_strings'] = true;
复制代码

默认路由会失效:
解决方法1:
在Function _set_routing()内将下面的代码提前放到这个函数内的前面:

  1. // Load the routes.php file.
  2. if (file_exists(APPPATH.'config/routes.php'))
  3. {
  4.     include(APPPATH.'config/routes.php');
  5. }

  6. if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/routes.php'))
  7. {
  8.     include(APPPATH.'config/'.ENVIRONMENT.'/routes.php');
  9. }

  10. // Validate & get reserved routes
  11. if (isset($route) && is_array($route))
  12. {
  13.     isset($route['default_controller']) && $this->default_controller = $route['default_controller'];
  14.     isset($route['translate_uri_dashes']) && $this->translate_uri_dashes = $route['translate_uri_dashes'];
  15.     unset($route['default_controller'], $route['translate_uri_dashes']);
  16.     $this->routes = $route;
  17. }
复制代码


解决方法2:
CI 目录下写一个 index.html
  1. <html>
  2. <head>
  3.     <meta http-equiv="Refresh" content="0;URL=index.php?c=index">
  4. </head>
  5. <body>
  6. </body>
  7. </html>
复制代码

本教程由无限星辰工作室CRX349独家整理和提供,转载请注明地址,谢谢。本文地址:https://www.xmspace.net/thread-398-1-1.html
无限星辰工作室  好集导航 Discuz全集下载  星辰站长网  集热爱361  一品文学  手机小游戏合集   海外空间网 星辰api  星辰支付二维码管理平台 阿里云服务器 腾讯云服务器
服务Discuz!建站|DiscuzQ配置|二开|小程序|APP|搬家|挂马清理|防护|Win/Linux环境搭建|优化|运维|
服务理念:专业 诚信 友好QQ842062626 服务项目 Q群315524225

发表于 2015-10-22 02:11:41 | 显示全部楼层 |阅读模式

回复 | 使用道具 举报

该帖共收到 0 条回复!
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

美图秀

    • fastadmin 后台界面使用字段数组类型
    • Discuz!x3.5 修改标题高亮颜色
    • Discuz!x3.5 应用中心 下载应用一直下载中
    • 帖子定时显示
    • 论坛辅助审核
拖动客服框
Online Service
点击这里给我发消息
点击这里联系我们
微信扫一扫
在线客服
快速回复 返回顶部 返回列表