Codeigniter中的不允许的关键字符错误消息(v2) [英] Disallowed key characters error message in Codeigniter (v2)

查看:81
本文介绍了Codeigniter中的不允许的关键字符错误消息(v2)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近在自定义cms我建设中遇到此错误 - 当我提交使用多选择的表单时,会出现此错误 - 任何人都可以提出此错误的最常见原因。



ok - 我认为它可能是多选择数组导致的问题,例如我有一个表中的数组这样。

 酒店[url] [] 
酒店[text] []
酒店[url] []
pre>

这不会在$ _POST中被允许?

解决方案

可能是您使用GET提交表单,而不是POST。多选择通常使用数组符号(myarray []),它们是URL中的CodeIgniter通常不允许的字符。



如果您确定使用POST然后我建议检查两件事:


  1. 确保如果您使用CodeIgniter的CSRF保护,您正在提交一个有效的令牌与形成。您可以通过禁用CSRF保护并尝试提交表单来测试这是否是问题。通常通过$ config ['csrf_protection']变量在config.php文件中启用CSRF保护。有关CodeIgniter的CSRF保护的更多信息,请访问此处

  2. 仔细检查您用于提交表单的网址,确保其中没有不允许的字符在应用程序/ config / config.php中的$ config ['permitted_uri_characters']中。


I've recently come across this error within a custom cms i'm building - this error appears when I submit a form that uses a multiselect - can anyone suggest the most common reasons for this error.

ok - i think it might be the multi-select arrays causing the problem, eg I have an array like this within a table..

hotels[url][]
hotels[text][]
hotels[url][]

Would this not be allowed in the $_POST?

解决方案

It could be you're submitting your form with GET instead of POST. Multi-selects usually use array notation (myarray[]) which are characters that are not usually allowed by CodeIgniter in the URL.

If you are sure you're using POST then I would suggest checking two things:

  1. Make sure that if you're using CodeIgniter's CSRF protection that you are submitting a valid token with the form. You can test whether this is the problem by disabling CSRF protection and trying to submit the form. The CSRF protection is usually enabled in your config.php file via the $config['csrf_protection'] variable. More info on CodeIgniter's CSRF protection can be found here.
  2. Double check the URL you're using to submit the form to make sure it doesn't have any characters that aren't permitted in your $config['permitted_uri_characters'] in application/config/config.php.

这篇关于Codeigniter中的不允许的关键字符错误消息(v2)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆