![](/img/trans.png)
[英]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.