本文介绍了在 Symfony 2 中使用 Twig 路径功能创建一个带有锚点的链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的 Twig 模板中创建一个带有像www.example.com/services#anchor1"这样的锚点的链接.到目前为止,我一直在使用 path 函数来创建链接 path('services').我已经尝试过 path('services#anchor1') 但显然它不起作用.

I'm trying to create a link with an anchor like "www.example.com/services#anchor1" in my Twig template. So far I've been using the path function to create links path('services'). I have tried with path('services#anchor1') but obviously it doesn't work.

关于这个功能的信息好像不是很多,或者只是我找不到.知道我该怎么做吗?

It doesn't seem to be a lot of information about this function or it's just that I can't find it. Any idea about how could I do it?

谢谢!

推荐答案

Try Home</a>

这篇关于在 Symfony 2 中使用 Twig 路径功能创建一个带有锚点的链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!