symfony2 twig whitelist html tags

后端 未结 5 2411
盖世英雄少女心
盖世英雄少女心 2021-02-20 08:23

I pass a variable to my twig template in Symfony2, this variable may contain
html tags, I have tried to create an extension (function), but the variabl

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-20 09:04

    You can do like that :

    {{ text | striptags('

    For instance,


    won't escape


    and

    and

    won't escape

    and

    etc.

提交回复
热议问题