Home  >  Article  >  PHP Framework  >  How to open gii in yii2

How to open gii in yii2

藏色散人
藏色散人Original
2020-07-20 09:32:482820browse

yii2 How to open gii: first check the configuration code in the "config/web.php" file; then open the "web/index.php" file; finally set "YII_ENV_DEV" to "true" .

How to open gii in yii2

yii2 gii enable

The gii module can be enabled by configuring the yii\base\Application::modules attribute. There will be the following configuration code in the config/web.php file:

Recommended: "yii tutorial"

$config = [ ... ];
if (YII_ENV_DEV) {
    $config['bootstrap'][] = 'gii';
    $config['modules']['gii'] = 'yii\gii\Module';
}

After checking, I found that my configuration is the same as above , but why I still can’t access it? It turns out there is another configuration. The above configuration means that if it is currently a development environment, the application will include the gii module, and the module class is yii\gii\Module. Next, let's go to the application's entry script web/index.php, and you will see the following code

efined('YII_ENV') or define('YII_ENV', 'dev');

Set YII_ENV_DEV to true, ok, and you can access it.

Another point is to turn off the urlManager beautification.

The above is the detailed content of How to open gii 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