This article mainly introduces to you about how to disable Debugging Toolbar Debug toolbar in Yii2 specific page, the article through the detailed sample code introduced in very detailed, to everyone's study or work has a certain reference learning value, need to have a look at the friends below.
Objective
This article mainly introduces to you on the YII2 specific page disables debugging Toolbar debug toolbar related content, shares out for everybody reference study, words not to say, come together to see the detailed introduction:
The Yii2 Debug toolbar is an artifact. As long as it is configured in the configuration file web.php, it can be used globally
Configuration adjustments for ' dev ' environment$config[' bootstrap ' [] = ' debug '; $config [' Modules '] [' debug '] = [' Class ' = ' yii\debug\module ',//uncomment the following to add your IP if is not connecting from localhost. ' Allowedips ' = [' 127.0.0.1 ', ':: 1 '],];
However, there are times when you need to disable the Debug toolbar on a specific page.
New Tool Class tools.php
Namespace App\libs;use yii;class tools{public static function Debugtoolbaroff () { if (class_exists (' \yii\debug\ Module ') { Yii:: $app->view->off (\yii\web\view::event_end_body, [\yii\debug\module::getinstance (), ' Rendertoolbar ']); } }}
Where you need to disable the Debug toolbar, such as an action, call directly
Use App\libs\tools;......public function Actionindex () {Tools::D ebugtoolbaroff (); return $this->render (' Index ');}