Symfony php呈现
我是Symfony3新手,我使用Twig渲染模板,一切都很好,但当我想切换到PHP渲染时,出现了错误: 我的班级:Symfony php呈现,php,symfony,Php,Symfony,我是Symfony3新手,我使用Twig渲染模板,一切都很好,但当我想切换到PHP渲染时,出现了错误: 我的班级: class Testdb extends Controller { /** * @Route("/testdb") * */ public function testing() { //return $this->render('testdb.html.twig',array('result'=>$
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中/
我编辑了我的config.yml:
templating:
engines: ['twig','php']
当我浏览
ttp://127.0.0.1:8000/testdb
I get模板“testdb.html.php”不存在
您需要呈现应用程序中的模板,或者至少指定模板位于哪个捆绑包/应用程序中
return $this->render(
'AppBundle:Default:testdb.html.php',
array('result'=>$result)
);
其中AppBundle是应用程序的名称,默认为tempalte所在的目录。您需要呈现应用程序内部的模板,或者至少指定模板所在的捆绑包/应用程序
return $this->render(
'AppBundle:Default:testdb.html.php',
array('result'=>$result)
);
其中AppBundle是应用程序的名称,默认为tempalte所在的目录。是否为您修复?是否为您修复?