Skip to content

Commit

Permalink
配置类库bug修改
Browse files Browse the repository at this point in the history
  • Loading branch information
lovefc committed Apr 19, 2022
1 parent 41d2032 commit d22c684
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 29 deletions.
41 changes: 15 additions & 26 deletions FC/Traits/Parents.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

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

trait Parents
Expand Down Expand Up @@ -96,15 +97,15 @@ public function P_Start()
* @param [type] $type
* @return object
*/
final function ReadConf($type)
final public function ReadConf($type)
{
if (isset($type)) {
$this->P_ConfigType = $type;
}
if (empty($this->P_ConfigType)) {
$this->P_RegVar = array_keys($this->P_Config);
} else {
$this->P_RegVar = array_keys($this->P_Config[$this->P_ConfigType]);
$this->P_RegVar = isset($this->P_Config[$this->P_ConfigType]) ? array_keys($this->P_Config[$this->P_ConfigType]) : [];
}
// 初始化
$this->P_Start();
Expand Down Expand Up @@ -138,22 +139,8 @@ public function __call($method, $args)
}
return $this;
}
*/

/**
* 获取配置,并关联
*
* @param [type] $file
* @param [type] $file2
* @return array
*/
final public static function P_GetConfig($file, $file2)
{
$config = self::P_GetConfigFile($file);
$config2 = self::P_GetConfigFile($file2);
// 组合配置
return array_replace_recursive($config, $config2);
}
*/


/**
* 读取配置目录以及工作目录里的配置文件
Expand All @@ -165,12 +152,15 @@ final public static function P_ReadConfigFile($conf)
{
$dir = PATH['FC_CONFIG'];
$file = $dir . '/' . $conf;
$file2 = PATH['NOW_CONFIG'] . '/' . $conf;
$config = $config2 = [];
if (is_file($file)) {
$file2 = PATH['NOW_CONFIG'] . '/' . $conf;
$config = self::P_GetConfig($file, $file2);
return $config;
$config = self::P_GetConfigFile($file);
}
return [];
if (is_file($file2)) {
$config2 = self::P_GetConfigFile($file2);
}
return array_replace_recursive($config, $config2);
}

/**
Expand Down Expand Up @@ -242,7 +232,6 @@ final public static function P_Receive($conf)
$config = self::P_GetConfigFile($conf, $ckey);
$config2 = self::P_ImpArray($config, $keys);
$re = $config2 ? $config2 : $config;

return $re;
}
return [];
Expand All @@ -263,7 +252,7 @@ final public function P_DefaultArrayConfig()

/**
* 获取到多维数组的值
*
*
* @param $config 数组
* @param $array 键名,多个
* @return array
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ composer.json
````
{
"require": {
"lovefc/fcphp": "6.2.5"
"lovefc/fcphp": "6.2.6"
}
}
````

````
composer require lovefc/fcphp:6.2.5
composer require lovefc/fcphp:6.2.6
````

### 使用方法
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "lovefc/fcphp",
"description": "FCPHP框架",
"keywords": ["php","fcphp","php框架","framework"],
"version": "6.2.5",
"version": "6.2.6",
"homepage": "https://gitee.com/lovefc/fcphp6.git",
"license": "MIT",
"require": {
Expand Down

0 comments on commit d22c684

Please sign in to comment.