Home > Article > PHP Framework > How to enable debugging in yii2
yii2How to enable debug
1. Add the following two lines of code to the web/index.php file:
defined('YII_DEBUG') or define('YII_DEBUG', true); defined('YII_ENV') or define('YII_ENV', 'dev');
2. Open the web.php file in the yii config directory, find the following configuration
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'], ]; }
and add your IP to it.
Recommended: "YII Tutorial"
The above is the detailed content of How to enable debugging in yii2. For more information, please follow other related articles on the PHP Chinese website!