重慶分公司,新征程啟航
為企業提供網站建設、域名注冊、服務器等服務
為企業提供網站建設、域名注冊、服務器等服務
小編給大家分享一下yii2開啟debug的方法,希望大家閱讀完這篇文章后大所收獲,下面讓我們一起去探討吧!
創新互聯建站-云計算及IDC服務提供商,涵蓋公有云、IDC機房租用、四川電信科技城機房、等保安全、私有云建設等企業級互聯網基礎服務,來電聯系:028-86922220
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添加進去即可。
看完了這篇文章,相信你對yii2開啟debug的方法有了一定的了解,想了解更多相關知識,歡迎關注創新互聯行業資訊頻道,感謝各位的閱讀!