|
发表于 2015-8-7 16:07:44
|
显示全部楼层
1、在application/core/里面建立 MY_URI.php
PHP复制代码 defined('BASEPATH') OR exit('No direct script access allowed');
class MY_URI extends CI_URI {
public function __construct () {
parent ::__construct ();
}
//URI过滤 允许中文
function filter_uri ($str) {
if ($str != '' AND $this->config->item('permitted_uri_chars') != '') {
$str = urlencode($str);
if (!preg_match("|^[".str_replace(array('\\-', '\-'), '-', preg_quote($this->config->item('permitted_uri_chars'), '-'))."]+$|i", $str) ) {
exit('The URI you submitted has disallowed characters.');
}
$str = urldecode($str);
}
return $str;
}
}
复制代码
注意: 在CI2.X里面 function _filter_uri($str) 在CI3.0里面是 function filter_uri($str)
2、将 application/config/config.php里面的
PHP复制代码 $config ['permitted_uri_chars'] = 'a-z 0-9~%.:_\-'; 复制代码
改为
PHP复制代码 $config['permitted_uri_chars'] = 'a-z 0-9~%.:_\+\-'; 复制代码
可以吗?
|
|