我正在使用该CHtml::link()
功能,但索引操作有问题。
视图中的代码:
echo CHtml::link('Watch it', array('video/index', 'id' => $id));
配置中的 urlManager 部分:
'urlManager' => array(
'urlFormat' => 'path',
'rules' => array(
'<id>/<action>' => 'video/<action>',
'<id>' => 'video/index'
)
)
我想要它做的是创建一个链接:
http://localhost/123
相反,它会创建一个链接到:
http://localhost/123/index
如何删除 '/index' 部分?
创建一个可以处理此问题的函数(将 '/index' 替换为空)将是解决此问题的最佳解决方案吗?