在 Symfony 2 中使用带有 Twig 路径功能的锚创建链接 [英] Create a link with an anchor with Twig path function in Symfony 2

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

问题描述

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?

Thanks!

解决方案

Try <a href="{{ path('_welcome') }}#home">Home</a>

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆