Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,23 @@ | ||
# 配置格式 | ||
## 基本格式 | ||
**Wooc** 采用数组的配置格式,如 | ||
|
||
return array( | ||
'DEF_APP' => 'cms', | ||
'DATABASE' => array( | ||
'dbName' => 'root', | ||
'dbUserPassword' => '123456' | ||
.... | ||
) | ||
..... | ||
); | ||
|
||
配置参数需要区分大小写,请一定要注意,第一层的属性全使用大写的风格,第二层的配置内容使用驼峰法的风格。 | ||
## 系统配置加载逻辑 | ||
**Wooc**使用从内到外的替换式的配置加载模式,即: | ||
1. 加载系统默认的所有配置参数; | ||
2. 加载应用自身的配置参数,如果应用的配置参数跟系统有同步,则以应用的配置为准; | ||
3. 加载应用当前使用的模板配置文件,如果模板的配置内容跟应用的有重名,则用模板的配置替换应用的配置。 | ||
|
||
这样的替换逻辑,可以让您开发出非常灵巧、多彩的系统,举个例子: | ||
> 如果您想做一个网站下用不同的数据库,您只需要做两个应用,然后把它们各自的配置改成对应的数据库配置即可!如果您有好些子站的功能其实都差不多,只是数据用的不一样,那么也可以同样使用这种方案,会给您的开发给维护成本,降到很惊人的程度! |