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~%\.\:_\-';
php 5.3下跟CI 1.7.2配合时"The URI you submitted has disallowed characters"错误的解决
精选 转载文章标签 The URI characters disallowed submitted 文章分类 PHP 后端开发
下一篇:我的友情链接
-
[PHP] PHP错误:Forbidden You don't have permission to access/on this server的解决方法
php错误Forbidden : You don't have permission to access / on this server的解决方法
php Forbidden php错误 permission to access