我是Symfony3的新手,我使用Twig渲染模板,一切都很好,但是当我想切换到PHP渲染时,我遇到了错误:
我的班级 :
class Testdb extends Controller
{
/**
* @Route("/testdb")
*
*/
public function testing()
{
//return $this->render('testdb.html.twig',array('result'=>$result));
return $this->render('testdb.html.php',array('result'=>$result));
}
}
我把我的testdb.html.php放在app/Resources/views/我编辑了我的配置:
templating:
engines: ['twig','php']
当我浏览ttp://127.0.0.1:8000/testdb
时,我得到The template "testdb.html.php" does not exist
您需要呈现应用程序内部的模板,或者至少指定模板所在的捆绑包/应用程序。
return $this->render(
'AppBundle:Default:testdb.html.php',
array('result'=>$result)
);
其中,AppBundle 是应用程序的名称,默认是