开发者

Disable CakePHP DebugKit

开发者 https://www.devze.com 2023-03-20 07:31 出处:网络
I recently installed the insanely useful DebugKit plugin for my CakePHP projects and I just realized that something wasn\'t working the way I expected it to work. I assumed that when I pushed code to

I recently installed the insanely useful DebugKit plugin for my CakePHP projects and I just realized that something wasn't working the way I expected it to work. I assumed that when I pushed code to production, the DebugKit wouldn't show up because my debug value is 0.

Although I haven't pushed to production yet, I did have a need to disable the plugin in my dev environment and it seems that simply setting the debug value to 0 isn't enough. I actually had to remove the plugin from my AppController to get it to stop...debugging.

Is this expected? There are no specific instructions for disabling, but I made one of those assumption things that setting Conf开发者_开发技巧igure::write( 'debug', 0 ) would suffice. Is this a bug or was my expectation just wrong?

Thanks.


Absolutely right, in CakePHP 1.2 I do this.

In my app_controller.php I use the following.

public function constructClasses() {

    if(Configure::read('debug') >= 1):
    $this->components[] = 'DebugKit.Toolbar';
    endif;

    parent::constructClasses();
}

Its simple and elegant.


just go to core.php file in app/Config

find this line Configure::write('debug', 2);

change to Configure::write('debug', 0);


In config/app.php you will see ...


'debug' => filter_var(env('DEBUG', true), FILTER_VALIDATE_BOOLEAN),


by default it is set to true, change it to false. that is..

'debug' => filter_var(env('DEBUG', false), FILTER_VALIDATE_BOOLEAN),

0

精彩评论

暂无评论...
验证码 换一张
取 消