第一步把config.php中的
'permitted_uri_chars'] = 'a-z 0-9~%.:_/-';
$config[$config['permitted_uri_chars'] = 'a-z 0-9~%.:_/-';
替换成
'permitted_uri_chars'] ='a-z 0-9~%.:_-u4e00-u9fa5';
$config[$config['permitted_uri_chars'] ='a-z 0-9~%.:_-u4e00-u9fa5';
第二步在application的libraries下增加一个My_URI.php文件,文件内容如下
<?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))
{
exit('The URI you submitted has disallowed characters.');
}
$str = urldecode($str);
}
return $str;
}
}
?>
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))
{
exit('The URI you submitted has disallowed characters.');
}
$str = urldecode($str);
}
return $str;
}
}
?>
注:apache下通过