为什么控制器不渲染树枝模板

Why controller not render twig template

我在 app/Resources/homepage 中有一个模板 (homepage.html.twig)。 我正在尝试在 HomeController class.

中呈现此模板

namespace AppBundle\Controller;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class HomeController extends Controller
{
    /**
     * @Route("/home", name="homepage")
     * @return \Symfony\Component\HttpFoundation\Response
     */
    public function homeAction()
    {
        return $this->render('homepage/homepage.html.twig');
    }
}

这是模板的内容。

{% extends 'base.html.twig' %}

{% block body %}
    <div class="container">
        <div class="jumbotron">
            <h1>Navbar example</h1>
            <p>This example is a quick exercise to illustrate how the default, static navbar and fixed to top navbar work. It includes the responsive CSS and HTML, so it also adapts to your viewport and device.</p>
            <p>
                <a class="btn btn-lg btn-primary" href=# role="button">View navbar docs &raquo;</a>
            </p>
        </div>
    </div>
{% endblock %}

为什么渲染模板不起作用?

我通过

解决了这个问题
{% block body %}
{% endblock %}

在base.html.twig