Home >PHP Framework >YII >How to initialize yii

How to initialize yii

(*-*)浩
(*-*)浩Original
2019-11-05 14:55:442711browse

Yii2 installation and initialization

How to initialize yii

##Yii2 is installed through Composer. Please refer to the official documentation or above for specific installation. the link content. (Recommended learning: yii tutorial)

After Yii2 is installed, it needs to be initialized according to the official documentation./init. When initializing here, we select Development mode and initialize The following files will be generated:

generate backend/config/main-local.php
generate backend/config/params-local.php
generate backend/config/test-local.php
generate backend/web/index-test.php
generate backend/web/index.php
generate common/config/main-local.php
generate common/config/params-local.php
generate common/config/test-local.php
generate console/config/main-local.php
generate console/config/params-local.php
generate frontend/config/main-local.php
generate frontend/config/params-local.php
generate frontend/config/test-local.php
generate frontend/web/index-test.php
generate frontend/web/index.php
generate yii
generate yii_testgenerate yii_test.bat
generate cookie validation key in backend/config/main-local.php
generate cookie validation key in frontend/config/main-local.php
  chmod 0777 backend/runtime
  chmod 0777 backend/web/assets
  chmod 0777 frontend/runtime
  chmod 0777 frontend/web/assets
  chmod 0755 yii
  chmod 0755 yii_test

It can be seen that the main work of Yii2 initialization is to generate some configuration files and script files. If you use GitHub as the code repository, you will find these configuration and script files Submissions are ignored by default. For details, see .gitignore in the directory where the file is located.

what does that mean? When you deploy the code to the production server through GitHub, you need to initialize again through ./init; of course, then you need to initialize in Production mode; you may find it annoying, but you will find out after you operate it This method is very flexible.

/vendor in the root directory is a third-party code library (including Yii2 source code, etc.). Submissions are ignored by default and are maintained by Composer.

However, since Composer is slow to be blocked in China, it is recommended to add /vendor to the repository. The specific operation is to comment out the contents of /vendor in the /.gitignore file in the root directory.

The above is the detailed content of How to initialize yii. 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
Previous article:yii close error promptNext article:yii close error prompt