php - symfony4 test.html.php 模板不存在
问题描述
通过编辑 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 模板引擎,所以它不是在templates
文件夹中查找文件,而是在src/Resources/views/
. 如果您要将文件放入src\Resources\views\test\test.html.php
一切正常的文件中(我对其进行了测试)。
推荐阅读
- r - Purrr 的修改功能
- sitemap - Google says: Sitemap.xml is HTML
- php - Problems with sending an email using smtp mandrill
- javascript - Test useEffect hook which has an aync method call within it
- google-apps-script - Deleting row from google sheets that are older than 30 days but date column is plain text format
- api - How to get URL preview of link shared in tweet using Twitter API?
- rust - Rust 在实现的 Struct 中调用 FnMut
- flutter - Email verification in flutter with firebase doesnt work?
- jsonnet - how can i create a parametrized template in jsonnet that inherits the fields of a (also parametrized) 'base object' via an import?
- http-live-streaming - mediastreamvalidator showing "Illegal MIME type" `application/x-mpegURL`