symfony - 如何在 Symfony2 项目的 prod 环境中启用调试工具栏?

标签 symfony toolbar

我有一个现有项目,只是想知道哪些文件以及应该更改哪些内容才能使调试工具栏在产品环境中可见

最佳答案

您应该更改 AppKernel.php 文件,以便在 prod 环境中启用 bundle ,并将路由从 routing_dev.yml 移动到 routing.yml 包定义路由。然后也在 config.yml 中添加配置。

例如:

AppKernel.php

        // Move this outside the if statement
        $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
        $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();

    if (in_array($this->getEnvironment(), array('dev', 'test'), true)) {
        $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
        $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
    }

路由.yml

#add this

_wdt:
    resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml"
    prefix:   /_wdt

_profiler:
    resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml"
    prefix:   /_profiler

config.yml

web_profiler:
    toolbar: true

希望这有帮助

关于symfony - 如何在 Symfony2 项目的 prod 环境中启用调试工具栏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39289095/

相关文章:

php - 是否可以将 Doctrine2 批处理与 Twig 的 for 标签无缝使用?

css - ExtJS 从工具栏更改元素的字体颜色

html - 网页页脚保留在浏览器窗口的底部

symfony - 我应该将学说注册表或特定存储库、实体管理器传递到 symfony2 中的 DI 容器吗?

Android选择文本工具栏选项颜色问题

WPF:为什么嵌套样式并不总是有效?

android - 如何在 Android xml 中的自定义工具栏上对齐 UI 控件

php - 未找到 Symfony 类

php - 以字符串形式获取Symfony 2.7中的表单验证错误

php - 将Symfony2应用程序连接到Docker中的数据库容器时出现问题