gongzhonghao.png
扫码关注我们
最新赞助活动温馨提示:自愿赞助服务器费用,学生和没有工作的整站资源免费下载!
头像

ci 3.0 默认路由放在子文件夹 无法访问的解决方案办法

来源:http://erdangjiade.com/topic/3035.html 你好,世界。 2017-09-25 22:42浏览(7)

本文转自:

比方说你想配置默认路由为: $route['default_controller'] = 'index/home';

ci3.0之前是可以放在 controllers中的子文件夹中的,但是到了ci3.0就必须直接放在 controllers下面,如果你坚持放在它的子文件夹下,那解决办法如下:

找到 system > core > router.PHP 2978-301 行注释掉。 ( 我的是 3.1.3版本 ) 如下:

  1. // if (sscanf($this->default_controller, '%[^/]/%s', $class, $method) !== 2)

  2. // {

  3. // $method = 'index';

  4. // }

然后在后面添加如下代码:

  1. $index = strripos($this->default_controller, '/'); // 记录 符号‘/’的下标

  2. if($index == false)

  3. {

  4. $class = $this->default_controller; // 没有‘/’ 的可以直接赋值

  5. }else{

  6. $this->directory = substr($this->default_controller, 0, $index + 1); //目录的字符串

  7. $class = substr($this->default_controller, $index + 1); //类的字符串

  8. }

  9. $method = $this->method; //默认方法



这样默认路由放在子文件夹下无法找到的问题就解决了。

以上就是ci 3.0 默认路由放在子文件夹 无法访问的解决办法的详细内容,更多请关注二当家的素材网其它相关文章!

评论0
头像

友情提示:垃圾评论一律封号 加我微信:826096331拉你进VIP群学习群

1 2