如何解決CI框架的Disallowed Key Characters錯誤提示
更新時間:2013年07月05日 09:56:27 作者:
本篇文章是對解決CodeIgniter框架應(yīng)用中,出現(xiàn)Disallowed Key Characters錯誤提示的方法,進(jìn)行了詳細(xì)的分析介紹,需要的朋友可以參考下
用CI框架時,有時候會遇到這么一個問題,打開網(wǎng)頁,只顯示 Disallowed Key Characters 錯誤提示。有人說 url 里有非法字符。但是確定 url 是純英文的,問題還是出來了。但清空瀏覽器歷史記錄和cookies后。 刷新就沒問題了。有時候。打開不同的瀏覽器。有的瀏覽器會有問題。有的就不會。
解決 CodeIgniter 框架應(yīng)用中,出現(xiàn)Disallowed Key Characters錯誤提示的方法。找到/system/core文件夾下的Input文件,將下面的代碼:
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 ( ! 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;
}
解決 CodeIgniter 框架應(yīng)用中,出現(xiàn)Disallowed Key Characters錯誤提示的方法。找到/system/core文件夾下的Input文件,將下面的代碼:
復(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;
}
改為:
復(fù)制代碼 代碼如下:
function _clean_input_keys($str)
{
$config = &get_config('config');
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;
}
您可能感興趣的文章:
- CI框架入門示例之?dāng)?shù)據(jù)庫取數(shù)據(jù)完整實現(xiàn)方法
- php ci框架中加載css和js文件失敗的解決方法
- CI框架中site_url()和base_url()的區(qū)別
- CI框架中l(wèi)ibraries,helpers,hooks文件夾詳細(xì)說明
- php CI框架插入一條或多條sql記錄示例
- php ci框架驗證碼實例分析
- CI框架中cookie的操作方法分析
- CI框架開發(fā)新浪微博登錄接口源碼完整版
- CI框架Session.php源碼分析
- CI框架自動加載session出現(xiàn)報錯的解決辦法
- CI框架源碼閱讀,系統(tǒng)常量文件constants.php的配置
- CI框架實現(xiàn)框架前后端分離的方法詳解
相關(guān)文章
PHP開發(fā)環(huán)境配置(MySQL數(shù)據(jù)庫安裝圖文教程)
下載完軟件后開始PHP開發(fā)環(huán)境的配置。注意是開發(fā)環(huán)境,不是服務(wù)器環(huán)境。2010-04-04PHP采集相關(guān)教程之一 CURL函數(shù)庫
目前為目最全的CURL中文說明了,學(xué)PHP的要好好掌握。有很多的參數(shù)。大部份都很有用。真正掌握了它和正則,一定就是個采集高手了。2010-02-02