質問

I have edited Url manager to provide SEO friendly urls but getting problem when the url have values with special characters such as . or () or - or any other special character

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

this change in array values results in error.

役に立ちましたか?

解決

As you want all sorts of characters, change your rule from the related question/answer:

'<controller:\w+>/<action:\w+>/<city>'=>'<controller>/<action>',
// omit the pattern \w+ from city:\w+

Documentation:

In case when ParamPattern is omitted, it means the parameter should match any characters except the slash /.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top