2014-04-28 44 views

回答

4

當您撥打render時,網址已被設置,因爲您位於controller(或view)。所以你現在不能在網址中添加錨點。

之前控制器called.To必須設置錨做到這一點,當你創建URL您可以設置一個錨:

$this->createUrl('controller/action', array('#' => 'the-anchor')); 

你也可以使用redirect的訪問者重定向到與該頁面錨點

$this->redirect(array('controller/action', array('#' => 'the-anchor'))); 

但我認爲在創建url時設置錨點是實現您想要的最佳方式。