草庐IT

htmlOtherFile

全部标签

php - Symfony2 : Get HTML from another file in controller

在我的Symfony2项目中,我想获取文件的HTML并将其放入Controller中的变量中。我有一个这样的Controller函数:publicfunctionmyControllerAction(){$htmlOtherFile='';return$this->render('@MyBundle/myTargetFile.html.twig',['htmlOtherFile'=>$htmlOtherFile]);}我想导入的html文件在我的View文件夹中:htmlOtherFile.html.twig如何将此文件的HTML放入我的$htmlOtherFile变量中?我已经尝试使