Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ms-access/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Yii 带有特殊字符的Url参数值在视图中提供错误_Yii_Yii Components - Fatal编程技术网

Yii 带有特殊字符的Url参数值在视图中提供错误

Yii 带有特殊字符的Url参数值在视图中提供错误,yii,yii-components,Yii,Yii Components,我编辑了Url管理器,以提供SEO友好的Url,但当Url的值带有特殊字符(如)时,就会出现问题。或()或-或任何其他特殊字符 http://localhost/nbnd/search/city/delhi In city action var_dump($_GET); output: array(1) { ["city"]=> string(6) "delhi" } but when url is with some special character http://localh

我编辑了Url管理器,以提供SEO友好的Url,但当Url的值带有特殊字符(如
)时,就会出现问题。或()或-或任何其他特殊字符

http://localhost/nbnd/search/city/delhi

In city action
var_dump($_GET);

output: array(1) { ["city"]=> string(6) "delhi" } 

but when url is with some special character
http://localhost/nbnd/search/city/north-delhi or
http://localhost/nbnd/search/city/north.delhi or
http://localhost/nbnd/search/city/(north)delhi

In city action
var_dump($_GET);

Output : array(1) { ["north-delhi"]=> string(0) "" } 
and so for other

数组值的更改会导致错误。

如果需要所有类型的字符,请从相关的:

”/:

如果省略ParamPattern,则表示该参数应匹配除斜杠/以外的任何字符


您希望允许哪些字符?@bool.dev我想要所有字符它以前使用默认url,但不使用SEO格式的url
'<controller:\w+>/<action:\w+>/<city>'=>'<controller>/<action>',
// omit the pattern \w+ from city:\w+