小編給大家分享一下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添加進(jìn)去即可。
看完了這篇文章,相信你對(duì)yii2開啟debug的方法有了一定的了解,想了解更多相關(guān)知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝各位的閱讀!