CodeIgniter - 不允许的关键字符

标签 codeigniter

这个问题在这里已经有了答案:




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/

相关文章:

php - Codeigniter - 限制从 URL 调用直接访问 Controller 功能

php - 将图像路径发送到数据库 codeigniter

codeigniter - Codeigniter 中的 iframe

php - 将 codeigniter 数据传递给简单的 html dom url 变量

数据库字符限制代码点火器

php - 从mysql数据库中恢复保存为 "???????"的原始数据

Mysql查询文章相关评论数

mysql - 合并按日期排序的mysql中两个表的记录

php - 使用 Codeigniter 实现 SHA 512 哈希

php - 使用 CodeIgniter 删除文件?