1

SEOに適したURLを提供するようにURLマネージャーを編集しましたが、URLに次のような特殊文字が含まれる場合に問題が発生します. 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

この配列値の変更により、エラーが発生します。

4

1 に答える 1

2

あらゆる種類の文字が必要なため、関連する質問/回答からルールを変更します。

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

ドキュメント

ParamPatternを省略した場合は、パラメーターがスラッシュ/以外のすべての文字と一致する必要があることを意味します。

于 2012-12-15T16:30:54.033 に答える