我的Web应用程序中有一个URL:
https://domain/store/cuisine?category=33
我想创建一个路由到:
https://domain/destiny to https://domain/cuisine?category=33
我又道:
'edobhi' => 'store/cuisine?category=33',
404错误提示404错误提示我该如何发送此邮件?
jtw3ybtb1#
查看此处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], ], ]
现在,您可以使用参数$category=33访问将Map到StoreController的https://domain/edobhi和操作actionCuisine
$category=33
StoreController
https://domain/edobhi
actionCuisine
1条答案
按热度按时间jtw3ybtb1#
查看此处https://www.yiiframework.com/doc/guide/2.0/en/runtime-routing#default-parameter-values
因此,您的规则看起来会像这样:
现在,您可以使用参数
$category=33
访问将Map到StoreController
的https://domain/edobhi
和操作actionCuisine