yii2如何关闭debug

yii2如何关闭debug,第1张

yii2如何关闭debug

这里采用的是yii2的advanced的版本。配置接口访问的debug模式。

配置文件目录: frontend/config/main-local.php (推荐学习:yii教程)

配置内容:

if (!YII_ENV_TEST) {
    // configuration adjustments for 'dev' environment
    $config['bootstrap'][] = 'debug';
    $config['modules']['debug']['class'] = 'yii\debug\Module';
    $config['modules']['debug']['allowedIPs'] = ['*', '127.0.0.1', '0.0.0.0'];
    $config['modules']['debug']['historySize'] = 200;
}

allowedIPs 字段表示允许访问的ip字段。然后historySize 表示存储的debug文件大小。

输入地址 frontend/web/index.php?r=debug 来进入debug模式。

点击tag能够进入这个请求里面,然后查看sql,cpu占有率,执行时间等。

关闭debug

在入口文件添加
defined('YII_DEBUG') or define('YII_DEBUG', false);
defined('YII_ENV') or define('YII_ENV', 'prod');

以上就是yii2如何关闭debug的详细内容,

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/700849.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-23
下一篇 2022-04-23

发表评论

登录后才能评论

评论列表(0条)

保存