Home > Article > PHP Framework > How to turn off debugging in yii2
The advanced version of yii2 is used here. Configure debug mode for interface access.
Configuration file directory: frontend/config/main-local.php (Recommended learning: yii tutorial)
Configuration content:
if (!YII_ENV_TEST) { // configuration adjustments for 'dev' environment $config['bootstrap'][] = 'debug'; $config['modules']['debug']['class'] = 'yii\debug\Module'; $config['modules']['debug']['allowedIPs'] = ['*', '127.0.0.1', '0.0.0.0']; $config['modules']['debug']['historySize'] = 200; }
allowedIPs field indicates the ip field that is allowed to be accessed. Then historySize represents the size of the stored debug file.
Enter the address frontend/web/index.php?r=debug to enter debug mode.
Click the tag to enter the request, and then view the SQL, cpu occupancy, execution time, etc.
Close debug
在入口文件添加 defined('YII_DEBUG') or define('YII_DEBUG', false); defined('YII_ENV') or define('YII_ENV', 'prod');
The above is the detailed content of How to turn off debugging in yii2. For more information, please follow other related articles on the PHP Chinese website!