在symfony 2中使用php模板而不是twig
我正在尝试使用php显示symfony模板。但是,symfony将我的php标记视为“注释” 我的控制器在symfony 2中使用php模板而不是twig,php,symfony,Php,Symfony,我正在尝试使用php显示symfony模板。但是,symfony将我的php标记视为“注释” 我的控制器 namespace Acme\testBundle\Controller; use Symfony\Component\HttpFoundation\Response; use Symfony\Bundle\FrameworkBundle\Controller\Controller; class testController extends Controller { public
namespace Acme\testBundle\Controller;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class testController extends Controller
{
public function helloAction()
{
//return new Response('Created product id ');
return $this->render('AcmetestBundle:test:test.html.php');
}
}
我的模板:test.html.php
<?php var_dump("Hello world");?>
我的输出:
<!--?php var_dump("Hello world");?-->
我怎样才能解决这个问题?你用谷歌搜索过吗 “Symfony2 PHP模板”的第一个结果:
可能只需要将php作为模板引擎添加到配置文件中
templating: { engines: ['twig','php'] }
还有什么建议吗?按Cerad建议启用细枝,清除缓存。还在继续
是。以下是指向文档的链接: