Home  >  Article  >  PHP Framework  >  How to turn off debugging in yii2

How to turn off debugging in yii2

(*-*)浩
(*-*)浩Original
2019-11-05 09:29:154671browse

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.

How to turn off debugging in yii2Click 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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn