在期间codeIgniter URI不允许? [英] Periods not allowed in CodeIgniter URI?

查看:176
本文介绍了在期间codeIgniter URI不允许?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,看过后在API版本这个问题,我决定preFIX我的所有路由使用版本号:

  HTTP://localhost/api/1.0/user/login

但是,当我抛出异常的核心内的例外,它说,该路线是:

  10 / UserControll ...

我试图逃避时期,但这并没有工作。任何人都可以复制这个问题,并认为一个可能的解决方案呢?

这是我使用上面的路线:

  $路线['1.0 /用户/(:任何)'] ='1.0 / UserController中/ $ 1';

这是我的允许的URI字符:

  $配置['permitted_uri_chars'] ='A-Z 0-9〜%\\:_ \\  - ';


解决方案

问题是在系统/核心/ Router.php 468线。更改 set_directory 此:

  $这个 - >目录= str_replace函数('。'阵列('/',),'',$ DIR)'/';

要这样:

  $这个 - >目录= str_replace函数(阵列('/'),'',$ DIR)'/';

任何人有一个猜测或鹅,为什么路由器从目录名中删除时期?

So after reading this question on API versioning, I decided to prefix all my routes with a version number:

http://localhost/api/1.0/user/login

But when I throw an exception within Exceptions Core, it says that the route is:

10/UserControll...

I've tried escaping the period, but this did not work. Can anyone replicate this problem and think of a possible solution for it?

This is the route I am using for the above:

$route['1.0/user/(:any)'] = '1.0/UserController/$1';

These are my permitted URI chars:

$config['permitted_uri_chars'] = 'a-z 0-9~%\.:_\-';

解决方案

The problem is on line 468 of system/core/Router.php. Change set_directory from this:

$this->directory = str_replace(array('/', '.'), '', $dir).'/';

To this:

$this->directory = str_replace(array('/'), '', $dir).'/';

Anyone have a guess or gander as to why the Router removes periods from directory names?

这篇关于在期间codeIgniter URI不允许?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆