Hab*_*wad 1 extends symfony twig
有两个twig文件src/MyVendor/MyBundle/Resources/views/MyApp/layout.html.twig和src/MyVendor/MyBundle/Resources/views/MyApp/myView.html.twig.
的内容的src /的Myvendor/MyBundle /资源/视图/ MyApp的/ myView.html.twig
{% extends "layout.html.twig" %}
{% block content %}
view content is here.
{% endblock %}
Run Code Online (Sandbox Code Playgroud)
但是我收到了一个错误
Unable to find template "layout.html.twig" in
"MyVendorMyBundle:MyApp:myView.html.twig"
Run Code Online (Sandbox Code Playgroud)
你应该这样做:
{% extends "MyVendorMyBundle:MyApp:layout.html.twig" %}
Run Code Online (Sandbox Code Playgroud)
您可以在文档中找到更多详细信息