【发布时间】:2014-01-06 13:19:45
【问题描述】:
对不起,我是新手,我在 Yii 框架中使用友好的 url。索引页面还可以,但是当我输入参数进行编辑时,url 不友好。
索引页:http://localhost/news/news/index.html
编辑页面:http://localhost/news/news/edit/59.html
我们如何隐藏 id 参数并拥有这样的 url:
http://localhost/news/news/edit.html
这是 main.php 中的配置
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName' => false,
'urlSuffix'=>'.html',
'rules'=>array(
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
),
非常感谢
【问题讨论】:
标签: yii