Disable HTML escaping when manually rendering a Twig string

前端 未结 1 2174
执念已碎
执念已碎 2021-02-19 17:56

I have the following code that renders a string into HTML output. How can I stop it from escaping the text for HTML?

$template = \'{{ who }} bar\';
$params = arr         


        
相关标签:
1条回答
  • 2021-02-19 18:41

    I dug through the Twig code and found that this works fine:

    $twig = new \Twig_Environment(new \Twig_Loader_String, array(
        'autoescape' => false
    ));
    
    0 讨论(0)
提交回复
热议问题