如何解決CI框架的Disallowed Key Characters錯誤提示
更新時間:2013年07月05日 09:56:27 作者:
本篇文章是對解決CodeIgniter框架應(yīng)用中,出現(xiàn)Disallowed Key Characters錯誤提示的方法,進行了詳細的分析介紹,需要的朋友可以參考下
用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框架入門示例之數(shù)據(jù)庫取數(shù)據(jù)完整實現(xiàn)方法
- php ci框架中加載css和js文件失敗的解決方法
- CI框架中site_url()和base_url()的區(qū)別
- CI框架中l(wèi)ibraries,helpers,hooks文件夾詳細說明
- 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中substr_count()函數(shù)獲取子字符串出現(xiàn)次數(shù)的方法
這篇文章主要介紹了PHP中substr_count()函數(shù)獲取子字符串出現(xiàn)次數(shù)的方法,結(jié)合實例分析了substr_count()函數(shù)的功能,參數(shù)作用及具體使用技巧,需要的朋友可以參考下2016-01-01
解析PHP的Yii框架中cookie和session功能的相關(guān)操作
這篇文章主要介紹了PHP的Yii框架中cookie和session功能的相關(guān)操作,需要的朋友可以參考下2016-03-03
PHP讀取XML文件的方法實例總結(jié)【DOMDocument及simplexml方法】
這篇文章主要介紹了PHP讀取XML文件的方法,結(jié)合實例形式總結(jié)分析了php基于DOMDocument及simplexml方法針對xml文件的載入、讀取等相關(guān)操作技巧,需要的朋友可以參考下2019-09-09
學習php設(shè)計模式 php實現(xiàn)合成模式(composite)
這篇文章主要介紹了php設(shè)計模式中的合成模式,使用php實現(xiàn)合成模式,感興趣的小伙伴們可以參考一下2015-12-12
PHP中strtr與str_replace函數(shù)運行性能簡單測試示例
這篇文章主要介紹了PHP中strtr與str_replace函數(shù)運行性能簡單測試,結(jié)合具體實例形式對比分析了PHP中strtr與str_replace函數(shù)的測試運行效率,需要的朋友可以參考下2019-06-06

