1 安装composer ,如已安装可跳过
widows :
下载并运行 Composer-Setup.exe
linux:
```
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
```
2 安装插件管理器,如已安装可跳过
composer global require "fxp/composer-asset-plugin:~1.1.1"
3 切换到 www 目录
cd /d D:\WWW
4 安装, 由于政策原因要等待较长时间。(注意最后的 xujiaBasic 是模板的文件夹名字,可以自行定义)
D:\WWW>composer create-project --prefer-dist --stability=dev yiisoft/yii2-app-advanced xujiaBasic
5 新建数据库,修改数据库配置,运行数据迁移
运行数据迁移
D:\WWW\xujiaBasic>php yii migrate
5 初始化 此时打开前台目录还没有入口文件,如下图
执行以下命令初始化
D:\WWW\xujiaBasic>php init
Yii Application Initialization Tool v1.0
Which environment do you want the application to be initialized in?
[0] Development
[1] Production
Your choice [0-1, or "q" to quit] 0
Initialize the application under 'Development' environment? [yes|no] yes
Start initialization ...
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_test
generate 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
... initialization completed.
再看前台