微信小程序

wechat开发笔记:Yii2的基础设置

wechat开发笔记:Yii2的基础设置

cookieValidationKey设置

  •  修改 config/web.php

urlManager设置

  •  修改config/web.php

  •  新建 router.php 专门做路由规则

router.php
return [
    'enablePrettyUrl' = true,
    'showScriptName' = false,
    'rules' => [
        '/' => '/default/index'
    ]
];

数据库配置&&修改默认首页

return [
    'class' => 'yii\db\Connection',
    'dsn' => 'mysql:host=localhost;dbname=tea',
    'username' => 'root',
    'password' => 'root',
    'charset' => 'utf8',
    'tablePrefix' => 'tea_',

    // Schema cache options (for production environment)
    //'enableSchemaCache' => true,
    //'schemaCacheDuration' => 60,
    //'schemaCache' => 'cache',
];

最近文章: