Codeigniter (v2) 中不允许的关键字符错误消息
我最近在我正在构建的自定义 cms 中遇到了此错误 - 当我提交使用多选的表单时会出现此错误 - 任何人都可以建议此错误的最常见原因。
好的 - 我认为这可能是多选数组引起的问题,例如我在表中有一个这样的数组..
hotels[url][]
hotels[text][]
hotels[url][]
$_POST 中不允许这样做吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果您查看 application/config 文件夹内的 config.php 文件,您会发现这一行:
It's a regex contains codeigniter alloweds 白名单字符。如果查询字符串中有其他内容,您将收到该错误。
If you look in your config.php file inside the application/config folder you'll find this line:
It's a regex containing whitelisted characters that codeigniter allows. If there is anything else in the querystring you will get that error.
您可能使用 GET 而不是 POST 提交表单。多选通常使用数组表示法 (myarray[]),这些字符通常是 CodeIgniter 在 URL 中不允许使用的字符。
如果您确定使用的是 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:
从输入名称中删除逗号。
例如:name['type'] 是错误的。
应该是名称[类型]
remove commas from your input names.
Eg: name['type'] is wrong.
It should be name[type]
我添加 |上例中的(管道)字符
I add | (pipe) character on the example above