fileRealPath($custom_file . $this->bili_file))) { $this->bili_file = $custom_file . $this->bili_file; Log::info('使用自定义' . $this->bili_file); } // 自定义设备 if (is_file($this->fileRealPath($custom_file . $this->device_file))) { $this->device_file = $custom_file . $this->device_file; Log::info('使用自定义' . $this->device_file); } // 加载数据 $this->device = new Config(); $loader = new YamlConfigLoader(); $processor = new ConfigProcessor(); $files = [$this->bili_file, $this->device_file]; // 循环加载 foreach ($files as $file) { $processor->extend($loader->load($this->fileRealPath($file))); } $this->device->import($processor->export()); } /** * @use 获取值 * @param $key * @param null $defaultFallback * @return mixed */ public function _get($key, $defaultFallback = null): mixed { return $this->device->get($key, $defaultFallback); } }