文件位置 system/core/Input.php
这和 CI 的字符串处理类设计有关,是这样的,通过get、post方法提交的字符串,CI 都交给 system/core/Input.php 这个类去处理。
url 里有非法字符。其实主要还包括post,get,cookie,session里面的数据,如果有非法字符串就会提示这个错误了。
所以要确保这些里面都没有非法字符串。
将Input类里的
1
2
3
4
5
6
7
8
|
function _clean_input_keys( $str ) { if (
! preg_match( "/^[a-z0-9:_/-]+$/i" , $str )) { exit ( 'Disallowed
Key Characters.' ); } return $str ; } |
换成
1
2
3
4
5
6
7
8
9
|
function _clean_input_keys( $str ) { $config =
&get_config( 'config' ); if (
! preg_match( "/^[" . $config [ 'permitted_uri_chars' ]. "]+$/i" ,
rawurlencode( $str ))) { exit ( 'Disallowed
Key Characters.' ); } return $str ; }
|