我想确定 CodeIgniter 是否 100% 支持这种行为。
我怀疑config.php
的permitted_uri_chars
是,如下:
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
它说只允许使用英文字符。但请考虑以下网址的结果:
http://localhost/codeigniter/index.php/controller/method/hell0-there+++
结果:The URI you submitted has disallowed characters.
http://localhost/codeigniter/index.php/controller/method/hello-سلام
结果:没问题!!!
这个词سلام
(在波斯语中,意思是“你好”)不能被模式接受'a-z 0-9~%.:_\-'
,但它不会像前面的例子那样出错!
为什么会发生这种行为?
现在下一个问题:是否需要在模式中添加和包含波斯字符?
我正在考虑将其更改config.php
为这样:
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
// Add all the persian characters after standard pattern:
$config['permitted_uri_chars'] .= 'آابپتثجچحخدذرزسشصضطظعغفقکگلمنوهیي۱۲۳۴۵۶۷۸۹۰';