Yii 带有特殊字符的Url参数值在视图中提供错误
我编辑了Url管理器,以提供SEO友好的Url,但当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
)时,就会出现问题。或()或-或任何其他特殊字符
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+