After enabling the php engine by editing the config/packages/framework.yaml, I am now facing the "The template ::/test/test.html.php" does not exit" error !!
Controller :
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');
}
}
Path: Templates/test/test.html.php
I figured it out. The Symfony team has not yet updated the php templating engine, so it looks for files not in the templates
folder, but in src/Resources/views/
. If you were to put your file in src\\Resources\\views\\test\\test.html.php
everything works (I tested it).
运行composer require symfony / twig-bundle,您将获得带有base.html.twig文件的模板文件夹
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.