How to use absolute path in twig functions

后端 未结 9 1098
情话喂你
情话喂你 2020-12-04 16:35

I have an application with Symfony2 (2.2). When I want to send a mail, I\'m having trouble with the paths, which are all relative paths and obviously aren\'t working inside

9条回答
  •  长情又很酷
    2020-12-04 16:54

    It's possible to have http://test_site.com and https://production_site.com. Then hardcoding the url is a bad idea. I would suggest this:

    {{app.request.scheme ~ '://' ~ app.request.host ~ asset('bundle/myname/img/image.gif')}}
    

提交回复
热议问题