不允许使用“@” Codeigniter URL 中的符号
我正在尝试让 Codeigniter 接受 URL 中的“@”符号。我已将其作为以下允许的字符之一包含在内:
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_@-';
但我仍然收到他的错误消息:
Disallowed Key Characters.
除了“@”符号之外,其他所有字符似乎都工作正常。有什么想法吗?
谢谢!
I'm trying to get Codeigniter to accept the "@" symbol in a URL. I've included it as one of the permitted characters below:
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_@-';
Yet I continue to get his error message:
Disallowed Key Characters.
Every other character seems to be working fine except for the "@" symbol. Any ideas?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
CodeIgniter 路由系统将您的 url 转换为将控制器、操作和参数定义为键/值。它检查键的值是否具有允许的字符,您可以使用
$config['permissed_uri_chars']
进行配置,但您收到的错误消息与键本身有关,而不是与它的值有关。在这种情况下,$config['permissed_uri_chars']
无法帮助您允许使用 @ 符号。您将在 system/core/input.php 中找到检查键的函数function _clean_input_keys($str)
。不允许使用 % 字符,因此 '%40' 将不会通过:在您的情况下,解决此问题的唯一方法是在关键参数中避免使用此字符(可能会翻译它)。
The CodeIgniter routing system translates your url to define controller, action and parameters as keys/values. It checks if the value of a key has permitted characters, and you can configure this with the
$config['permitted_uri_chars']
, but the error message you get is about the key itself not about its value. The$config['permitted_uri_chars']
doesn't help you to allow the @ symbol in this case. You will find the functionfunction _clean_input_keys($str)
that checks the keys in system/core/input.php. The % character is not allowed so '%40' will not pass:The only way around this in your case is to avoid this character (maybe translating it) in key parameters.
您是否在允许的 uri 字符串中添加了正确的转义?
我从我的 CI 站点之一复制了此权利,并且允许 %40。
请参阅上面pekka关于实际@符号的评论。
Did you add proper escaping to your permitted uri string?
I copied this right from one of my CI sites and %40 is allowed.
Please refer to pekka's comment above about the actual @ symbol.