codeigniter不允许的关键字符-允许所有字符时 [英] codeigniter Disallowed Key Characters - when all characters are allowed

查看:74
本文介绍了codeigniter不允许的关键字符-允许所有字符时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

CodeIgniter不允许使用的关键字符

我最近将CI从1.7升级到了2.0 。在那之后我开始收到配置项了

I recently upgraded CI from 1.7 to 2.0. There after i started receiving CI's


不允许的关键字符

Disallowed Key Characters

错误。

然后我允许所有字符都被接受,以查看错误是否会消失。

I then allowed all characters to be accepted to see if the error would disappear.

$config['permitted_uri_chars'] = '';

但是,这并没有改变

i还启用了查询字符串

i also have enabled query strings

$config['enable_query_strings'] = TRUE;

我只是不知道为什么我允许所有字符都出现错误字符

I just don't know why i am getting the disallowed characters error when i am allowing all characters to be accepted.

这是一个网址示例,在该示例中,我会收到不允许的键字符错误:

Here is a url example where i would get the disallowed key characters error:

http://localhost/myapp/index.php??c=user&m=login

但是,如果我要删除?之一,则可以使用

However, if i were to remove one of the '?' it works

http://localhost/myapp/index.php?c=user&m=login

我确实有一个htaccess文件包含:

I do have an htaccess file that contains:

RewriteEngine on
RewriteRule (.*)/index.php $1/ [L]

有帮助吗?

推荐答案

似乎CodeIgniter会对GET / POST /和cookie数据键名进行单独检查,并根据以下条件验证它们:

It looks like CodeIgniter does a separate check for GET/POST/and cookie data key names where it validates them against:

/^[a-z0-9:_\/-]+$/i

请参阅: https://bitbucket.org/ellislab/codeigniter/src/c2dad3edb148/system/core/Input.php#cl-537

除了编辑/分类Input.php之外,我看不到禁用此检查的简便方法。不过,最好还是使用没有奇怪符号的键。

I don't see an easy way to disable this check other than editing/subclassing Input.php. You're probably better off using keys without weird symbols anyway though.

这篇关于codeigniter不允许的关键字符-允许所有字符时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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