yii 新建应用的配置步骤
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