如何解決CI框架的Disallowed Key Characters錯誤提示_PHP教程
推薦:解析PHP實現(xiàn)下載文件的兩種方法本篇文章是對使用PHP實現(xiàn)下載文件的兩種方法進行了詳細的分析介紹,需要的朋友參考下 方法一: 復制代碼 代碼如下: header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filen
用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;
}
分享:PHP系統(tǒng)命令函數(shù)使用分析本篇文章是對PHP中系統(tǒng)命令函數(shù)的使用進行了詳細的分析介紹,需要的朋友參考下 復制代碼 代碼如下: function execute($cmd) { $res = ''; if ($cmd) { if(function_exists('system')) { @ob_start(); @system($cmd); $res = @ob_get_contents(); @ob_end_clean(); } els
- 相關(guān)鏈接:
- 教程說明:
PHP教程-如何解決CI框架的Disallowed Key Characters錯誤提示
。