CodeIgniter 中 permitted_uri_chars 的问题

Issue with permitted_uri_chars in CodeIgniter

我在 CodeIgniter 中遇到 permitted_uri_chars 问题。以下是我的配置:

$config['permitted_uri_chars'] = 'a-z 0-9~%.:_-()@!';

根据我的配置,应该允许使用特殊符号。它适用于符号,但当我组合使用符号时它不起作用。

场景:

http://localhost/ci/test/index/page(new).html

当我的 URL 如上所述时,我收到错误:

An Error Was Encountered

The URI you submitted has disallowed characters.

但以下工作正常。

http://localhost/ci/test/index/page(new.html

http://localhost/ci/test/index/pagenew).html

我该如何解决这个问题?我不想使用 .htaccess 解决这个问题!!

@TomPHP 请将以下字符放入您的 config.php 文件中。

$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-()@!';

您忘记将 \ 放入允许引发 uri 问题的字符中。

尝试添加这个。适合我。

$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-()@!';