下载安装:
composer方式:(并不好使) php composer.phar global require "fxp/composer-asset-plugin:^1.2.0" php composer.phar create-project yiisoft/yii2-app-advanced advanced 2.0.13 #要安装很久 文档方式: 下载解压:http://www.yiiframework.com/download/
执行初始化:advanced下php init或双击运行init.bat
配置数据库:/common/config/main-local.php,并在数据库中创建该库
'db' => [ 'class' => 'yiidbConnection', 'dsn' => 'mysql:host=localhost;dbname=yii2', #如果连不上就把localhost改为127.0.0.1 'username' => 'root', 'password' => '', 'charset' => 'utf8', ],
数据库迁移:
php yii migrate
如果缺少包
composer install
基础版需要的cookie验证
'cookieValidationKey' => 'maoriaty', #/config/web.php中添加自定义字符串
使用gii工具
http://localhost/advanced/backend/web/index.php?r=gii
在数据库中添加用户admin=123456
username=admin authkey=Iz6otklwwgZniAE8EXSZKVj1BPNwrg8A password_hash=$2y$13$WD5tqVxLI7rUhJpkg8EWwOAB5pt0eFaHyO4shX5BFGb7KAcSVjQQi