How to disable dump symfony function on production

后端 未结 5 989
青春惊慌失措
青春惊慌失措 2021-01-02 20:03

How to disable dump() function, when its in production environment? If i forget the dump function anywhere It crashes with an 500 error

5条回答
  •  青春惊慌失措
    2021-01-02 21:03

    Veve's answer was good but I suggest to you to try the fllowing solution.

    NB: this is just to unlock you. You should remove the dump() from your prod code!

    In app/AppKernel.php add this:

    class AppKernel extends Kernel
    {
    
    public function registerBundles()
    {
        $bundles = [
             new Symfony\Bundle\DebugBundle\DebugBundle(),
             new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(),
             # code ...
        ];
    
        # ...
    }
    

提交回复
热议问题