在创建的Twig_Environment中渲染dump()

时间:2015-05-23 13:43:21

标签: php symfony twig

我尝试在新的Twig_Environment中使用调试扩展,例如

$twig = new \Twig_Environment(new \Twig_Loader_String());
$twig->addExtension( new \Twig_Extension_Debug());
$rendered = $twig->render(
"out : {{ dump(array) }}",
array("array" => ['aa','bb'])
);

die($rendered);

告诉我:

为什么dump()不起作用?

1 个答案:

答案 0 :(得分:2)

好的,我找到了

$twig = new \Twig_Environment(new \Twig_Loader_String(),array(
            'debug' => true,
        ));