yii2-基础 搭建博客 - 安装yii2 配置环境

##1. 安装 (npm方法安装)

### 查看版本

##1.下载安装yii2 

composer create-project yiisoft/yii2-app-advanced my-blog

下载完成后在  environments/dev/common/config/main-local.php

配置基本数据库信息

```

return [

    'components' => [

        'db' => [

            'class' => 'yii\db\Connection',

            'dsn' => 'mysql:host=localhost;dbname=yii2advanced',

            'username' => 'root',

            'password' => '',

            '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,

        ],

    ],

];

```


2.配置nginx   --》不再说明

执行 php init 初识化配置信息

因为我用的mongodb所以需要配置下mongogii

mongo用户表结构

用户表

id  username   phone  email  password  password_hash status type createTime  updateTime

生成user modle



-----未完待续-----

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容