|
楼主 |
发表于 2010-7-6 10:53:50
|
显示全部楼层
终于解决了。在CI的URI中会进行过滤,将编程字符过滤掉,其中包括以下五个
$, (, ), %28, %29
所以在URI获取$str的时候,CI已经将(转转变成(所以在进行数据库搜索的时候查不到结果,但是显示在浏览器中没有任何差别。
可以用var_dump查看(与(的区别。感谢Hex的帮助!
PHP复制代码 function _filter_uri ($str)
{
if ($str != '' && $this->config->item('permitted_uri_chars') != '' && $this->config->item('enable_query_strings') == FALSE)
{
// preg_quote() in PHP 5.3 escapes -, so the str_replace() and addition of - to preg_quote() is to maintain backwards
// compatibility as many are unaware of how characters in the permitted_uri_chars will be parsed as a regex pattern
if ( ! preg_match("|^[".str_replace(array('\\-', '\-'), '-', preg_quote($this->config->item('permitted_uri_chars'), '-'))."]+$|i", $str))
{
show_error ('The URI you submitted has disallowed characters.', 400);
}
}
// Convert programatic characters to entities
$bad = array('$', '(', ')', '%28', '%29');
$good = array('$', '(', ')', '(', ')');
return str_replace($bad, $good, $str);
} 复制代码 |
|