如何通过yii2设置关闭调试模式?

2026-05-07 03:421阅读0评论SEO教程
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计164个文字,预计阅读时间需要1分钟。

如何通过yii2设置关闭调试模式?

关闭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

本文共计164个文字,预计阅读时间需要1分钟。

如何通过yii2设置关闭调试模式?

关闭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