我的config.yml
如下:
imports:
- { resource: parameters.yml }
- { resource: security.yml }
framework:
#translator: { fallback: %locale% }
secret: %secret%
router:
resource: "%kernel.root_dir%/config/routing.yml"
strict_requirements: ~
form: ~
csrf_protection: ~
validation: { enable_annotations: true }
templating:
engines: ['twig']
#assets_version: SomeVersionScheme
default_locale: "%locale%"
trusted_proxies: ~
session: ~
fragments: ~
http_method_override: true
我收到错误:
'The service definition "templating.engine.twig" does not exist.'
但是Twig扩展名在/vendor/twig
文件夹中。我还需要做些什么才能让它发挥作用?
答案 0 :(得分:1)
您必须注册TwigBundle并进行配置。在Symfony标准版中可以看到一个例子:
# Twig Configuration
twig:
debug: "%kernel.debug%"
strict_variables: "%kernel.debug%"
new Symfony\Bundle\TwigBundle\TwigBundle(),