时间:2021-07-01 10:21:17 帮助过:5人阅读
Yii2 框架如何将 www.test.com/product.html?id=5252 这样的 配置成www.test.com/product-5252.html
可以尝试在配置文件里设置类似以下这种形式
- <code><!--?php
- return [
- ...
- 'components' =--> [
- ...
- 'urlManager' => [
- 'enablePrettyUrl' => true,
- 'showScriptName' => true,
- 'suffix' => '.html',
- 'rules' => [
- 'product-<id:\d+>' => 'product/view',
- ],
- ],
- ],
- ...
- ];</id:\d+></code>