【发布时间】:2016-09-02 09:33:26
【问题描述】:
我有一个现有项目,只是想知道哪些文件以及我应该更改哪些内容以使调试工具栏在 prod 环境中可见
【问题讨论】:
-
我与其他问题所暗示的情况不同,我只需要更改需要更改的行和文件即可。
-
@AlexanderGuz 答案是指框架的不同版本
我有一个现有项目,只是想知道哪些文件以及我应该更改哪些内容以使调试工具栏在 prod 环境中可见
【问题讨论】:
您应该更改 AppKernel.php 文件以在 prod 环境中启用捆绑包,并将路由从 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();
}
routing.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
希望有帮助
【讨论】: