yii 新建应用的配置步骤

作者: wxfeng 分类: php 发布时间: 2017-01-11 00:00

1,复制文件夹backend,重命名为新的应用名称,如:api;

$cp backend/ api/ -r

2,修改初始化环境配置文件: environments/index.php

return [
    'Development' => [
        'path' => 'dev',
        'setWritable' => [

            'api/runtime',
            'api/web/assets',

            'backend/runtime',
            'backend/web/assets',
            'frontend/runtime',
            'frontend/web/assets',
        ],
        'setExecutable' => [
            'yii',
            'tests/codeception/bin/yii',
        ],
        'setCookieValidationKey' => [           

            'api/config/main-local.php',

             'backend/config/main-local.php',
            'frontend/config/main-local.php',
        ],
    ],
    'Production' => [
        'path' => 'prod',
        'setWritable' => [

            'api/runtime',
            'api/web/assets',

            'backend/runtime',
            'backend/web/assets',
            'frontend/runtime',
            'frontend/web/assets',
        ],
        'setExecutable' => [
            'yii',
        ],
        'setCookieValidationKey' => [

            'api/config/main-local.php',

            'backend/config/main-local.php',
            'frontend/config/main-local.php',
        ],
    ],
];

3,切换到path中对应的目录,即dev,复制文件夹backend,重命名为api;

$cp backend/ api/ -r

4,执行初始化

切换到项目根目录,执行:

$./init

如果觉得我的文章对您有用,请随意赞赏。您的支持将鼓励我继续创作!

发表评论

电子邮件地址不会被公开。 必填项已用*标注