Skip to content

Commit d22c684

Browse files
committed
配置类库bug修改
1 parent 41d2032 commit d22c684

File tree

3 files changed

+18
-29
lines changed

3 files changed

+18
-29
lines changed

FC/Traits/Parents.php

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44

55
/*
66
* 配置多继承父类
7-
* @Author: lovefc
8-
* @Date: 2016/8/29 10:51:27
7+
* @Author: lovefc
8+
* @Date: 2016/8/29 10:51:27
99
* @Last Modified by: lovefc
1010
* @Last Modified time: 2019-10-12 13:59:55
11+
* @Last Modified time: 2022-04-19 13:46:23
1112
*/
1213

1314
trait Parents
@@ -96,15 +97,15 @@ public function P_Start()
9697
* @param [type] $type
9798
* @return object
9899
*/
99-
final function ReadConf($type)
100+
final public function ReadConf($type)
100101
{
101102
if (isset($type)) {
102103
$this->P_ConfigType = $type;
103104
}
104105
if (empty($this->P_ConfigType)) {
105106
$this->P_RegVar = array_keys($this->P_Config);
106107
} else {
107-
$this->P_RegVar = array_keys($this->P_Config[$this->P_ConfigType]);
108+
$this->P_RegVar = isset($this->P_Config[$this->P_ConfigType]) ? array_keys($this->P_Config[$this->P_ConfigType]) : [];
108109
}
109110
// 初始化
110111
$this->P_Start();
@@ -138,22 +139,8 @@ public function __call($method, $args)
138139
}
139140
return $this;
140141
}
141-
*/
142-
143-
/**
144-
* 获取配置,并关联
145-
*
146-
* @param [type] $file
147-
* @param [type] $file2
148-
* @return array
149-
*/
150-
final public static function P_GetConfig($file, $file2)
151-
{
152-
$config = self::P_GetConfigFile($file);
153-
$config2 = self::P_GetConfigFile($file2);
154-
// 组合配置
155-
return array_replace_recursive($config, $config2);
156-
}
142+
*/
143+
157144

158145
/**
159146
* 读取配置目录以及工作目录里的配置文件
@@ -165,12 +152,15 @@ final public static function P_ReadConfigFile($conf)
165152
{
166153
$dir = PATH['FC_CONFIG'];
167154
$file = $dir . '/' . $conf;
155+
$file2 = PATH['NOW_CONFIG'] . '/' . $conf;
156+
$config = $config2 = [];
168157
if (is_file($file)) {
169-
$file2 = PATH['NOW_CONFIG'] . '/' . $conf;
170-
$config = self::P_GetConfig($file, $file2);
171-
return $config;
158+
$config = self::P_GetConfigFile($file);
172159
}
173-
return [];
160+
if (is_file($file2)) {
161+
$config2 = self::P_GetConfigFile($file2);
162+
}
163+
return array_replace_recursive($config, $config2);
174164
}
175165

176166
/**
@@ -242,7 +232,6 @@ final public static function P_Receive($conf)
242232
$config = self::P_GetConfigFile($conf, $ckey);
243233
$config2 = self::P_ImpArray($config, $keys);
244234
$re = $config2 ? $config2 : $config;
245-
246235
return $re;
247236
}
248237
return [];
@@ -263,7 +252,7 @@ final public function P_DefaultArrayConfig()
263252

264253
/**
265254
* 获取到多维数组的值
266-
*
255+
*
267256
* @param $config 数组
268257
* @param $array 键名,多个
269258
* @return array

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ composer.json
1212
````
1313
{
1414
"require": {
15-
"lovefc/fcphp": "6.2.5"
15+
"lovefc/fcphp": "6.2.6"
1616
}
1717
}
1818
````
1919

2020
````
21-
composer require lovefc/fcphp:6.2.5
21+
composer require lovefc/fcphp:6.2.6
2222
````
2323

2424
### 使用方法

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "lovefc/fcphp",
33
"description": "FCPHP框架",
44
"keywords": ["php","fcphp","php框架","framework"],
5-
"version": "6.2.5",
5+
"version": "6.2.6",
66
"homepage": "https://gitee.com/lovefc/fcphp6.git",
77
"license": "MIT",
88
"require": {

0 commit comments

Comments
 (0)