1、修改config.php
把 $config['permitted_uri_chars'] = 'a-z 0-9~%.:_/-'; 修改成如下:
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_-u4e00-u9fa5';
2、实现类MY_URI,放到system/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))
{
exit('The URI you submitted has disallowed characters.');
}
$str = urldecode($str);
}
return $str;
}
}
?>
3、在控制器中这样用:
parse_str($_SERVER['QUERY_STRING'], $_GET);
$id = $_GET["id"];
4、通过以上四步,即可。
该文章是转载的,忘记出处了!!!