我正在使用Symfony 2渲染PHP模板,我有模板代码:
phptemplate.html.php
:
...
<?php echo $view->render('MyBundle:Def:info.html.twig', array('m' => $m)) ?>
...
MyBundle:Def:info.html.twig
:
abc
{{ url('form_individual') }}
{{ m.test }}
abc
输出显示结果:
abc
{{ url('form_individual') }}
{{ m.test }}
abc
变量不会呈现,而是显示为文本,为什么?
答案 0 :(得分:1)
PhpEngine
不支持twig
模板。因此,您的twig
模板(可能)被解析为纯文本。
PhpEngine
supports
方法Source code和here基础文档supports
其中:Returns true if this class is able to render the given template.
。
为什么你没有将你的MyBundle:Def:info.html.twig
模板重写为php?或者父母一个twig
?