Turn off escaping in Symfony 2 / twig

前端 未结 2 603
野的像风
野的像风 2021-01-18 09:00

I\'m creating a form using the form builder in Symfony. I am adding an attribute into the twig file for my checkboxes which contains an ampersand and pound sign, Symfony is

相关标签:
2条回答
  • 2021-01-18 09:25

    You can use |raw filter. http://symfony.com/doc/current/book/templating.html#output-escaping-in-twig

    0 讨论(0)
  • 2021-01-18 09:47

    Probably what you need is the raw tag or filter. Also take a look at the autoescape tag.

    To turn autoescaping off globally, set the autoescape option to false in config.yml:

    twig:
        # ...
        autoescape: false
    
    0 讨论(0)
提交回复
热议问题