[英]Symfony4 'ERROR : Variable does not exist', when i call a variable in my template
[英]symfony4 test.html.php template does not exist
通過編輯config / packages / framework.yaml啟用php引擎后,我現在面臨“模板:: / test / test.html.php不會退出”錯誤!
控制器:
namespace App\Controller;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class TestController extends Controller
{
/**
* @Route("/test.html.php", name="testphp")
*/
public function testphp(){
return $this->render('test/test.html.php');
}
}
路徑: Templates / test / test.html.php
我想到了。 Symfony團隊尚未更新php模板引擎,因此它不在src/Resources/views/
目錄中查找文件而不位於templates
文件夾中。 如果將文件放在src\\Resources\\views\\test\\test.html.php
一切正常(我已經對其進行了測試)。
運行composer require symfony / twig-bundle,您將獲得帶有base.html.twig文件的模板文件夾
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.