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的詳細內容。更多資訊請關注PHP中文網其他相關文章!