get current url in twig template?

后端 未结 6 1354
粉色の甜心
粉色の甜心 2020-11-30 17:44

I looked around for the code to get the current path in a Twig template (and not the full URL), i.e. I don\'t want http://www.sitename.com/page, I only need

6条回答
  •  攒了一身酷
    2020-11-30 18:24

    Get current url: {{ app.request.uri }} in Symfony 2.3, 3, 4, 5


    Get path only: {{ app.request.pathinfo }} (without parameters)


    Get request uri: {{ app.request.requesturi }} (with parameters)

提交回复
热议问题