PHP Yii创建元素ID链接的方法


PHP Yii way to create a link to an element ID

我已经环顾四周,似乎找不到一种方法来创建链接到id的锚标记。

例如

<a href='#element-id'> Link to an element </a>

尝试让页面滚动到指定的元素。无论出于何种原因,链接被添加到URL中,但没有移动页面。我已经用html::Link方法和标准html标记进行了测试。这是处理url的方式吗?

try this:

CHtml::link( 'Link to an element', array('controller/action','#'=>'element-id'));