如何设置Yii2框架开启调试模式?

2026-05-06 15:050阅读0评论SEO问题
  • 内容介绍
  • 文章标签
  • 相关推荐

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

如何设置Yii2框架开启调试模式?

相关专题:

1、 在web/index.php文件中添加下面两行代码:

defined('YII_DEBUG') or define('YII_DEBUG', true); defined('YII_ENV') or define('YII_ENV', 'dev');

2、打开yii config目录下的web.php文件,找到如下配置

if (YII_ENV_DEV) { // configuration adjustments for 'dev' environment $config['bootstrap'][] = 'debug'; $config['modules']['debug'] = [ 'class' => 'yii\debug\Module', // uncomment the following to add your IP if you are not connecting from localhost. 'allowedIPs' => ['127.0.0.1', '我的IP'], ]; $config['bootstrap'][] = 'gii'; $config['modules']['gii'] = [ 'class' => 'yii\gii\Module', // uncomment the following to add your IP if you are not connecting from localhost. 'allowedIPs' => ['127.0.0.1', '我的IP'], ]; }

把自己的IP添加进去即可。

阅读全文
标签:YII2debug

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

如何设置Yii2框架开启调试模式?

相关专题:

1、 在web/index.php文件中添加下面两行代码:

defined('YII_DEBUG') or define('YII_DEBUG', true); defined('YII_ENV') or define('YII_ENV', 'dev');

2、打开yii config目录下的web.php文件,找到如下配置

if (YII_ENV_DEV) { // configuration adjustments for 'dev' environment $config['bootstrap'][] = 'debug'; $config['modules']['debug'] = [ 'class' => 'yii\debug\Module', // uncomment the following to add your IP if you are not connecting from localhost. 'allowedIPs' => ['127.0.0.1', '我的IP'], ]; $config['bootstrap'][] = 'gii'; $config['modules']['gii'] = [ 'class' => 'yii\gii\Module', // uncomment the following to add your IP if you are not connecting from localhost. 'allowedIPs' => ['127.0.0.1', '我的IP'], ]; }

把自己的IP添加进去即可。

阅读全文
标签:YII2debug