yii2.0高级版安装(advanced)

1.执行命令:

composer create-project --prefer-dist yiisoft/yii2-app-advanced yii

 

 2.安装成功后拷贝后台文件夹改名api

 

 3.进行初始化,cd到项目目录下进行init初始化操作,命令依次是init,0,y

 

 4.数据库文件修改,创建数据库操作

 

 

return [
    'components' => [
        'db' => [
            'class' => 'yii\db\Connection',
            'dsn' => 'mysql:host=localhost;dbname=yii2advanced',
            'username' => 'root',
            'password' => 'root',
            'charset' => 'utf8',
        ],
        'mailer' => [
            'class' => 'yii\swiftmailer\Mailer',
            'viewPath' => '@common/mail',
            // send all mails to a file by default. You have to set
            // 'useFileTransport' to false and configure a transport
            // for the mailer to send real emails.
            'useFileTransport' => true,
        ],
    ],
];

5.数据库迁移操作,命令yii migrate

 

posted @ 2022-03-27 22:50  不负&韶华  阅读(451)  评论(0)    收藏  举报