






















最近在用CI的时候。在测试的时候有时候返回:Disallowed Key Characters ,如果清空游览器会好,但如果有多用户登录后会经常出现。搜索才发现是CI的Input.php的处理有问题。
需要修改Input.php的地方如下:
function _clean_input_keys($str) { if ( ! preg_match("/^[a-z0-9:_\/-]+$/i", $str)) { exit('Disallowed Key Characters.'); } // Clean UTF-8 if supported if (UTF8_ENABLED === TRUE) { $str = $this->uni->clean_string($str); } return $str; }
这里修改成如下:
function _clean_input_keys($str) { $config = &get_config('config'); if (!empty($config['permitted_uri_chars'])) { if (!preg_match("/^[".$config['permitted_uri_chars']."]+$/i", rawurlencode($str))) { exit('Disallowed Key Characters.'); } }
// Clean UTF-8 if supported if (UTF8_ENABLED === TRUE) { $str = $this->uni->clean_string($str); }
return $str; }
然后把 config/config.php 里面的:
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
修改成
$config['permitted_uri_chars'] = '';
就没出现这问题了。
见:http://www.kukaka.org/home/content/576
或:http://www.nowamagic.net/librarys/veda/detail/1699
function _clean_input_keys($str) { if(preg_match("/^,_[a-z0-9:_\/-]+$/",$str)){ $str = preg_replace("/,_/","",$str); } if ( ! preg_match("/^[a-z0-9:_\/-]+$/i", $str)) { exit('Disallowed Key Characters.'.$str); } return $str; }
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。