在搭建好CI框架後訪問http://localhost/ci的時候總是出現Disallowed Key Characters.
解決辦法:
在項目中搜索到包含“Disallowed Key Characters”的位置,一般在ci/system/core/Input.php中,大概在731行左右有如下代碼:
if ( ! preg_match("/^[a-z0-9:_\/-]+$/i", $str)) { exit('Disallowed Key Characters.'); }
把上面3行代碼修改成下面的代碼即可解決問題:
$config = &get_config('config'); if ( ! preg_match("/^[".$config['permitted_uri_chars']."]+$/i", rawurlencode($str))) { exit('Disallowed Key Characters.'); }