我与树枝模板的关系有问题。
它返回原始 html 字符而不是 html 标记。
<?php
/* HomepageController.php */
namespace App\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
class HomepageController extends AbstractController
{
/**
* @Route("/homepage/")
*/
public function homepage()
{
return $this->render('homepage/homepage.html.twig', [
'title' => 'this will be title',
]);
}
}
homepage.html.twig
<h1>this should show html content</h1>
<p>{{ title }} </p>
浏览器输出
<h1>this should show html content</h1>
<p>this will be title </p>
树枝.yaml
twig:
default_path: '%kernel.project_dir%/templates'
debug: '%kernel.debug%'
strict_variables: '%kernel.debug%'
exception_controller: null
你知道我要设置的配置是什么吗
偶然的你
慕斯709654