How can I disable yii-debug-toolbar on a specific view?

杀马特。学长 韩版系。学妹 提交于 2019-12-02 22:51:07

Put this in your layout or view file:

if (class_exists('yii\debug\Module')) {
    $this->off(\yii\web\View::EVENT_END_BODY, [\yii\debug\Module::getInstance(), 'renderToolbar']);
}

This removes the callback that renders the toolbar from the event that runs at the end of the layout, where you have $this->endBody().

Tanvir Rahman

Just Remove or comments out the those two lines from /config/web.php

$config['bootstrap'][] = 'debug';
$config['modules']['debug'] = 'yii\debug\Module';
Goodini
public function beforeAction($action) {

    if ( $action->controller->id=='elfinder' && Yii::$app->getModule('debug') )
        Yii::$app->getModule('debug')->instance->allowedIPs = [];
    return parent::beforeAction($action);
}

I found a better way. Put This In Anywhere:

Yii::$app->log->targets['debug'] = null;

And this does not make files in /runtime/debug

Umair Hamid

if you want to remove from front end then this is the way:

  1. Goto frontend/config/main-local.php
  2. Comment out these two lines:

main-local.php

  $config['bootstrap'][] = 'debug';    
  $config['modules']['debug'] = 'yii\debug\Module';

This will remove debug bar from front-end.

$config['bootstrap'][] = 'debug';
$config['modules']['debug'] = 'yii\debug\Module';

Comment out the above lines of code above. this worked for me. This do in frontend and backend to disable that debug tool or module at the footer of the website.

Remove this from config/web.php

$config['bootstrap'][] = 'debug';
$config['modules']['debug'] = 'yii\debug\Module';

If you don't wan to show the log, you can hide the yii-debug console using jQuery

   $('#ydtb-toolbar').hide();

Call this snippet on your views.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!