yii2如何开启debug

yii2如何开启debug,第1张

yii2如何开启debug

yii2如何开启debug

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添加进去即可。

推荐:《YII教程》

以上就是yii2如何开启debug的详细内容,

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

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

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

发表评论

登录后才能评论

评论列表(0条)

保存