Routes zf2到书签的路由

Routes zf2到书签的路由,routes,zend-framework2,bookmarks,Routes,Zend Framework2,Bookmarks,在zf2中,如何编写路由以指向页面中的书签?例如,如果目标页面具有以下内容: <h2 id="tips">Useful Tips Section</h2> 有用提示部分 我们希望路由器生成以下内容: <a href="target_page#tips">Visit the Useful Tips Section</a> 应该使用什么路由类型以及语法是什么 <a href="<?= $this->url('your_ro

在zf2中,如何编写路由以指向页面中的书签?例如,如果目标页面具有以下内容:

<h2 id="tips">Useful Tips Section</h2>
有用提示部分
我们希望路由器生成以下内容:

<a href="target_page#tips">Visit the Useful Tips Section</a>

应该使用什么路由类型以及语法是什么


<a href="<?= $this->url('your_route', [], ['fragment' => 'tips']) ?>">...</a>

URL视图帮助器的选项可用于此目的。片段也可以在控制器插件中使用,如。

您可以使用URL视图帮助程序的
片段
选项,如下所述。