php - Symfony2 错误 : The service "templating" has a dependency on a non-existent service "templating.globals"

标签 php symfony templates

我刚刚使用以下命令安装了一个包以在我的项目中激活 Mustache 模板,但现在我收到以下错误;

服务“templating”依赖于一个不存在的服务“templating.globals”。

我使用的命令是:

composer.phar 需要 bobthecow/mustache-bundle

当然我知道我缺少 templating.globals 服务,但我如何包含它以及为什么它没有自动包含?

最佳答案

templating.globals 服务仅由 symfony/framework-bundle 创建,前提是您在模板引擎的列表中有 php

正如您在 Resources/config/templating_php.xml 中看到的那样服务已创建。

此文件仅在 php is in the list of templating engines 时加载到扩展名中.

TL;DRphp 添加到您的 app/config/config.yml 中的模板引擎。

# app/config/config.yml
framework:
    # ...
    templating:
        engines: ['twig', 'php']

关于php - Symfony2 错误 : The service "templating" has a dependency on a non-existent service "templating.globals",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33404302/

相关文章:

templates - Bigcommerce:%%SNIPPET_SideCategoryList%% - 底层模板文件在哪里?

Java Play Framework 嵌套模板 - 参数传递

php - 如何在 PHP 中测试连通性?

php - .htaccess 使用 SSL 将 www 重定向到非 www

PHP url 识别

分配 64 字节时 PHP PDO 允许内存耗尽

javascript - 如何重写javascript库函数?

arrays - 在 Symfony 2 中从 ArrayCollection 获取随机元素时出现问题

php - 具有 X num 个关系属性的动态过滤器查询 - Doctrine Symfony2

C++ 可变参数模板 : remove/replace type at index