这个问题在这里已经有了答案:
9年前关闭。
Possible Duplicate:
CodeIgniter Disallowed Key Characters
我尝试提交的表单存在一些问题,它的动态和复选框值来自数据库,唯一的问题是其中一个字段具有
#
当我尝试提交表单时,它返回 'disallowed key characters'
.我如何才能提交
#
?
最佳答案
它被硬编码到函数 _clean_input_keys() 中的 Input 类中。
只需创建一个 MY_Input 类并覆盖该函数。
/**
* Clean Keys
*
* This is a helper function. To prevent malicious users
* from trying to exploit keys we make sure that keys are
* only named with alpha-numeric text and a few other items.
*
* @access private
* @param string
* @return string
*/
function _clean_input_keys($str)
{
// if ( ! preg_match("/^[a-z0-9:_\/-]+$/i", $str)) <---- DEL
if ( ! preg_match("/^[#a-z0-9:_\/-]+$/i", $str)) // <----INS
{
exit('Disallowed Key Characters.');
}
// Clean UTF-8 if supported
if (UTF8_ENABLED === TRUE)
{
$str = $this->uni->clean_string($str);
}
return $str;
}
关于CodeIgniter - 不允许的关键字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5423212/