How do I disable the Symfony 2 profiler bar?

前端 未结 8 1548
清酒与你
清酒与你 2021-01-30 10:29

It\'s not adding anything and it makes the page slower and I want it gone. Don\'t ask. There\'s little about the profiler on the website and nothing in the app config.

8条回答
  •  情深已故
    2021-01-30 10:56

    To still get output in /_profiler but without the toolbar, you can cheat:

    $request->headers->add(array('X-Requested-With' => 'XMLHttpRequest'));
    

    That's because in WebProfilerBundle/EventListener/WebDebugToolbarListener.php there's an explicit check for this before injecting the toolbar.

提交回复
热议问题