php 5.3下跟CI 1.7.2配合时"The URI you submitted has disallowed characters"错误的解决
来源:互联网 发布:beta理财顾问软件 编辑:程序博客网 时间:2024/05/17 09:20
php 5.3的最新版本时,跟CI 1.7.2配合时,有时会出现:
The URI you submitted has disallowed characters的错误,
解决方法如下:
主要是因为preg_quote是在每个允许的字符前加了一个反斜杠:
让a-z 0-9变成了“a\-z 0\-9″,解决为,
在libraries目录下,设置为my_uri.php
class MY_URI extends CI_URI {
function _filter_uri($str)
{
if ($str != '' AND $this->config->item('permitted_uri_chars') != '')
{
$str = urlencode($str);
// if ( ! preg_match("|^[".preg_quote($this->config->item('permitted_uri_chars'))."]+$|i", $str))
if ( ! preg_match("|^[".($this->config->item('permitted_uri_chars'))."]+$|i", rawurlencode($str)))
{
exit('The URI you submitted has disallowed characters.');
}
$str = urldecode($str);
}
return $str;
}
注意的是,去掉preg_quote函数,而在
config.php中:
$config['permitted_uri_chars'] = 'a-z 0-9~%\.\:_\-';
The URI you submitted has disallowed characters的错误,
解决方法如下:
主要是因为preg_quote是在每个允许的字符前加了一个反斜杠:
让a-z 0-9变成了“a\-z 0\-9″,解决为,
在libraries目录下,设置为my_uri.php
class MY_URI extends CI_URI {
function _filter_uri($str)
{
if ($str != '' AND $this->config->item('permitted_uri_chars') != '')
{
$str = urlencode($str);
// if ( ! preg_match("|^[".preg_quote($this->config->item('permitted_uri_chars'))."]+$|i", $str))
if ( ! preg_match("|^[".($this->config->item('permitted_uri_chars'))."]+$|i", rawurlencode($str)))
{
exit('The URI you submitted has disallowed characters.');
}
$str = urldecode($str);
}
return $str;
}
注意的是,去掉preg_quote函数,而在
config.php中:
$config['permitted_uri_chars'] = 'a-z 0-9~%\.\:_\-';
- php 5.3下跟CI 1.7.2配合时"The URI you submitted has disallowed characters"错误的解决
- ci框架url传递参数出现:The URI you submitted has disallowed characters
- codeigniter框架The URI you submitted has disallowed characters.错误解决方案
- 解决CI框架的Disallowed Key Characters错误提示
- YOU SAY "THE RULE IS HERE",BUT I SAY "WHY?"
- php switch case的"bug"
- CI框架提交表单时出现 Disallowed Key Characters 错误提示
- "this class is not key value coding-compliant for the key ..."问题的解决
- Exception in thread "main" java.lang.LinkageError错误的解决
- linux下"没有设置 SVN_EDITOR...."错误解决方法
- file_get_contents("php://input");
- 连接时发生"一般性网络错误"的另类解释
- "streambuf" ambiguous symbol的问题如何解决
- 【Linux】Centos下的"vim"的配置
- FCKeditor出现"this connector is disabled Please check the"editor/filemanager/connectors/aspx/config.aspx"错误的解决办法
- 解决 CodeIgniter 框架应用中,出现Disallowed Key Characters错误提示的方法
- "git rm" 和 "rm" 的区别
- 解决内核编译时产生 "mkimage" command not found - U-Boot images will not be built 错误
- flex 4里一个传统的闪烁效果
- codeigniter学习2
- Bonjour
- php中双引号和单引号的区别
- Mysql索引优化
- php 5.3下跟CI 1.7.2配合时"The URI you submitted has disallowed characters"错误的解决
- Qt程序非线程类中sleep()函数的替代方法。
- flex4里的双向数据绑定
- (转)sphinx安装配置手记
- evernote-mode 不能登录的解决办法
- 一位老外眼中的php bad code example,大家来看看
- php5中的===与==
- asp.net 2010中jquery调用webservice
- VC++ 6中编译Unicode时出现error LNK2001: unresolved external symbol _WinMain@16