In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
这篇文章主要介绍"如何解决CodeIgniter框架提示Disallowed Key Characters的问题",在日常操作中,相信很多人在如何解决CodeIgniter框架提示Disallowed Key Characters的问题问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答"如何解决CodeIgniter框架提示Disallowed Key Characters的问题"的疑惑有所帮助!接下来,请跟着小编一起来学习吧!
打开ci框架的源码不难发现,在ci的核心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;
}
这是进行过滤的,所以抛出错误
我们在application的core中对这个方法进行重写即可
命名一个为MY_Input.php(前缀MY_可以在config.php中自定义),然后将下面代码加入即可
复制代码 代码如下:
class AI_Input extends CI_Input {
//构造函数
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;
}
}
到此,关于"如何解决CodeIgniter框架提示Disallowed Key Characters的问题"的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注网站,小编会继续努力为大家带来更多实用的文章!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.