我们如何在yii框架的url中隐藏参数?
对不起,我是新的bie,我在Yii框架中使用友好的url。索引页是可以的,但当我输入参数进行编辑时,url不友好 索引页:我们如何在yii框架的url中隐藏参数?,yii,Yii,对不起,我是新的bie,我在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(
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>',
),
),
'urlManager'=>数组(
“urlFormat'=>“路径”,
'showScriptName'=>false,
'urlSuffix'=>'.html',
'规则'=>数组(
“/”=>“/视图”,
'//'=>'/',
'/'=>'/',
),
),
非常感谢您必须在url上附加某种形式的标识符来表示唯一的记录。如果你想去掉ID,可以使用标题或文本来达到让URL搜索引擎友好的目的。如果你要走那条路线,你必须设置一个自定义url规则。 有关更多信息,请参阅