Home > PHP Framework > YII > body text

How to enable debugging in yii2

angryTom
Release: 2019-11-06 17:45:49
Original
9683 people have browsed it

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

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

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!

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