symfony4 test.html.php 模板不存在

0 php symfony4

通过编辑 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');
    }
}
Run Code Online (Sandbox Code Playgroud)

路径:Templates/test/test.html.php

Dir*_*ber 5

我想到了。Symfony 团队尚未更新 php 模板引擎,因此它不在templates文件夹中查找文件,而是在src/Resources/views/. 如果你把你的文件放在src\Resources\views\test\test.html.php一切正常(我测试过)。