我有这个网址
http://example.com/index.PHP/controller_name/action_name?queryString=123
这个网址工作正常但是当我尝试使用像旧版Yii中的queryString时
http://example.com/index.PHP/controller_name/action_name/queryString/123
我已经在配置文件中启用了prettyurl,以下网址正在运行
http://example.com/index.PHP/controller_name/action_name.
我的配置看起来像:
'urlManager' => [
'class' => 'yii\web\UrlManager',
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
'<controller:\w+>/<id:\d+>' => '<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
'<controller:\w+>/<action:\w+>' => '<controller>/<action>',
'module/<module:\w+>/<controller:\w+>/<action:\w+>' => '<module>/<controller>/<action>',
],
],
我错过了什么?
解决方法:
遗憾的是,此功能未迁移到Yii2,您仍可以手动定义此类规则
'books/view/queryString/<queryString:\w+>' => 'books/view',
Link on github with this issue
Because of many client API and Oauth servers don’t work without encode