您的位置:首页 > 编程语言 > PHP开发

yii2高级模板添加新增模块

2015-09-16 00:00 871 查看
例, 增加一个 API 的专用模块,在系统初始化的时候 修改 environments\index.php 文件,如下:

return [
'Development' => [
'path' => 'dev',
'setWritable' => [    // 设置可写目录
'api/runtime',
'api/web/assets',
'api/controllers',   //当前目录设置为可写为 Gii 使用,所以生产环境不需要配置
'api/models',        //当前目录设置为可写为 Gii 使用,所以生产环境不需要配置
'backend/controllers',  //当前目录设置为可写为 Gii 使用,所以生产环境不需要配置
'backend/models',    //当前目录设置为可写为 Gii 使用,所以生产环境不需要配置
'backend/runtime',
'backend/web/assets',
'frontend/controllers',   //当前目录设置为可写为 Gii 使用,所以生产环境不需要配置
'frontend/models',       //当前目录设置为可写为 Gii 使用,所以生产环境不需要配置
'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' => [
&
3ff0
nbsp;   'yii',
],
'setCookieValidationKey' => [
'api/config/main-local.php',
'backend/config/main-local.php',
'frontend/config/main-local.php',
],
],
];


后期也可以增加,命令行情况下重新执行根目录下的 init 文件即可,注意不要重写了配置文件;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: