如何在 Symfony2 项目的 prod 环境中启用调试工具栏? [英] How enable debugging toolbar in prod environment of a Symfony2 project?
本文介绍了如何在 Symfony2 项目的 prod 环境中启用调试工具栏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个现有项目,只是想知道哪些文件以及我应该更改哪些内容以使 prod 环境中的调试工具栏可见
I have an existing project and just would like to know which files and what should I change to make visible the debug toolbar in the prod environment
推荐答案
您应该在 AppKernel.php
文件中进行更改,以便在 prod 环境中也启用 bundle 并更改从routing_dev.yml
到 routing.yml
包定义路由.然后在 config.yml
中添加配置.
You should change in the AppKernel.php
file in order to enable the bundle in the prod environment also and change the route moving from the routing_dev.yml
to the routing.yml
the bundle definition route. Then add the configuration in the config.yml
also.
例如:
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
希望对您有帮助
这篇关于如何在 Symfony2 项目的 prod 环境中启用调试工具栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文