我开始学习Symfony,我对确切放置此页面上显示的示例YAML代码的位置感到困惑:https://symfony.com/doc/current/cookbook/templating/render_without_controller.html
具体来说,此代码的位置在哪里:
acme_privacy:
path: /privacy
defaults:
_controller: FrameworkBundle:Template:template
template: static/privacy.html.twig
我在搜索答案时最接近的是这篇文章:Not using templates Symfony 2。但是,它并没有说明放置此代码的位置。
由于
编辑:我的app / config / routing.yml文件
_wdt:
resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml"
prefix: /_wdt
_profiler:
resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml"
prefix: /_profiler
_configurator:
resource: "@SensioDistributionBundle/Resources/config/routing/webconfigurator.xml"
prefix: /_configurator
_errors:
resource: "@TwigBundle/Resources/config/routing/errors.xml"
prefix: /_error
_main:
resource: routing.yml
我将此添加到文件末尾并且有效!
testing_privacy:
path: /privacy
defaults:
_controller: FrameworkBundle:Template:template
template: static/privacy.html.twig
答案 0 :(得分:3)
可能在{{1}}