Disable HTML escaping when manually rendering a Twig string

前端 未结 1 1527
野性不改
野性不改 2021-02-19 18:28

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:57

    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)
提交回复
热议问题