CI框架提交表单时出现 Disallowed Key Characters 错误提示

来源:互联网 发布:魔兽世界5.4.8数据库 编辑:程序博客网 时间:2024/06/14 08:56


文件位置 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;  
}


0 0
原创粉丝点击