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

How to turn off debugging in yii2

(*-*)浩
Release: 2019-11-05 09:29:15
Original
4835 people have browsed it

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;
}
Copy after login

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');
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template