Home  >  Article  >  PHP Framework  >  How to enable debugging in yii2

How to enable debugging in yii2

angryTom
angryTomOriginal
2019-11-06 17:45:499684browse

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!

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