本文介绍了symfony2 webprofiler 显示生产环境的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
开发环境中的系统使用 jquery 运行得很慢,但在 prod 中运行得很好,可以将 webprofiler 放在 prod 环境中吗?问候和感谢
The system in the dev environment going very slow with jquery but in prod me very well, could put the webprofiler in the prod environment? greetings and thanks
推荐答案
将此添加到 routing.yml
:
_wdt:
resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml"
prefix: /_wdt
_profiler:
resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml"
prefix: /_profiler
将此添加到config_prod.yml
:
web_profiler:
toolbar: true
在 AppKernel.php
中更改:
从此语句中删除 $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle()
:
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
// ...
}
并将其添加到 if 语句之外的 bundles 数组中:
and add this to the bundles array outside of the if statement:
new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle()
在 app.php
中设置 debug=true
In app.php
set debug=true
$kernel = new AppKernel('prod', true);
在config_prod.yml
中添加:
framework:
profiler:
only_exceptions: false
这应该可以解决问题.
不要忘记在更改代码后执行此操作:
Don't forgot to execute this after making the code changes:
$ php ./app/console cache:clear --env=prod --no-debug
这篇关于symfony2 webprofiler 显示生产环境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!