手机
当前位置:查字典教程网 >编程开发 >php教程 >如何解决CI框架的Disallowed Key Characters错误提示
如何解决CI框架的Disallowed Key Characters错误提示
摘要:用CI框架时,有时候会遇到这么一个问题,打开网页,只显示DisallowedKeyCharacters错误提示。有人说url里有非法字符。但...

用CI框架时,有时候会遇到这么一个问题,打开网页,只显示 Disallowed Key Characters 错误提示。有人说 url 里有非法字符。但是确定 url 是纯英文的,问题还是出来了。但清空浏览器历史记录和cookies后。 刷新就没问题了。有时候。打开不同的浏览器。有的浏览器会有问题。有的就不会。

解决 CodeIgniter 框架应用中,出现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;

}

【如何解决CI框架的Disallowed Key Characters错误提示】相关文章:

最省空间的计数器

汉字转化为拼音(php版)

用PHP生成PDF文件 with FPDF

php获取网页上所有链接的方法

PHP设计模式之装饰者模式代码实例

迪菲-赫尔曼密钥交换(Diffie–Hellman)算法原理和PHP实现版

如何正确理解PHP的错误信息

PHP初学者头疼问题总结

php判断是android还是ios还是wp的访问网站

用PHP制作静态网站的模板框架(二)

精品推荐
分类导航