欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

CodeIgniter框架提示Disallowed Key Characters的解決辦法

 更新時間:2014年04月21日 11:41:29   作者:  
在做項目過程中,出現(xiàn)提交form表單的時候,出現(xiàn)了Disallowed Key Characters 的提示

打開ci框架的源碼不難發(fā)現(xiàn),在ci的核心input類中有這樣一個函數(shù):

復(fù)制代碼 代碼如下:

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;
}

這是進行過濾的,所以拋出錯誤

我們在application的core中對這個方法進行重寫即可
命名一個為MY_Input.php(前綴MY_可以在config.php中自定義),然后將下面代碼加入即可

復(fù)制代碼 代碼如下:

class AI_Input extends CI_Input {

    //構(gòu)造函數(shù)
    function __construct(){
        parent::__construct();
    }

    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;
    }
}

相關(guān)文章

最新評論