我的Web应用程序中有一个URL:
https://domain/store/cuisine?category=33
我想创建一条到达以下地点的路线:
https://domain/destiny to https://domain/cuisine?category=33
我添加了:
'edobhi' => 'store/cuisine?category=33',
在urlManager上,但我得到404。
我该如何路由?
看这里https://www.yiiframework.com/doc/guide/2.0/en/runtime-routing#default-parameter-values
所以您的规则将如下所示:
'rules' => [
// ...other rules...
[
'pattern' => 'edobhi',
'route' => 'store/cuisine',
'defaults' => ['category' => 33],
],
]