core/Config.php
public static function load($name, $overwrite = false)
    {
        if (is_array($name)) {
            $data = [];
            foreach ($name as $value) {
                $temp = self::load($value);
                $data = array_merge($data, $temp);
            }
            return $data;
        }

        //如果应用目录下存在配置文件夹使用应用目录下面的配置文件
        $appPath = Route::getPath();
        if (!empty($appPath)) {
            $filePath = Utils::path($appPath, 'config', $name . '.config.php');
            if (file_exists($filePath)) {
                $loadData = require($filePath);
                if (is_array($loadData)) {
                    foreach ($loadData as $key => $val) {
                        if ($overwrite) {
                            self::$global[$name . '.' . $key] = $val;
                        } else {
                            if (!isset(self::$global[$name . '.' . $key])) {
                                self::$global[$name . '.' . $key] = $val;
                            }
                        }
                    }
                }
                self::$loaded[$name] = 1;
                return $loadData;
            }
        }
        //使用根目录下的配置文件
        if (empty(self::$configPath)) {
            self::$configPath = Utils::path(ROOT_DIR, 'config');
        }
        $filePath = Utils::path(self::$configPath, $name . '.config.php');
        if (file_exists($filePath)) {
            $loadData = require($filePath);
            if (is_array($loadData)) {
                foreach ($loadData as $key => $val) {
                    if ($overwrite) {
                        self::$global[$name . '.' . $key] = $val;
                    } else {
                        if (!isset(self::$global[$name . '.' . $key])) {
                            self::$global[$name . '.' . $key] = $val;
                        }
                    }
                }
            }
            self::$loaded[$name] = 1;
            return $loadData;
        }
        return [];
    }
public static function load($name, $overwrite = false)
    {
        if (is_array($name)) {
            $data = [];
            foreach ($name as $value) {
                $temp = self::load($value);
                $data = array_merge($data, $temp);
            }
            return $data;
        }

        //如果应用目录下存在配置文件夹使用应用目录下面的配置文件
        $appPath = Route::getPath();
        if (!empty($appPath)) {
            $filePath = Utils::path($appPath, 'config', $name . '.config.php');
            if (file_exists($filePath)) {
                $loadData = require($filePath);
                if (is_array($loadData)) {
                    foreach ($loadData as $key => $val) {
                        if ($overwrite) {
                            self::$global[$name . '.' . $key] = $val;
                        } else {
                            if (!isset(self::$global[$name . '.' . $key])) {
                                self::$global[$name . '.' . $key] = $val;
                            }
                        }
                    }
                }
                self::$loaded[$name] = 1;
                return $loadData;
            }
        }
        //使用根目录下的配置文件
        if (empty(self::$configPath)) {
            self::$configPath = Utils::path(ROOT_DIR, 'config');
        }
        $filePath = Utils::path(self::$configPath, $name . '.config.php');
        if (file_exists($filePath)) {
            $loadData = require($filePath);
            if (is_array($loadData)) {
                foreach ($loadData as $key => $val) {
                    if ($overwrite) {
                        self::$global[$name . '.' . $key] = $val;
                    } else {
                        if (!isset(self::$global[$name . '.' . $key])) {
                            self::$global[$name . '.' . $key] = $val;
                        }
                    }
                }
            }
            self::$loaded[$name] = 1;
            return $loadData;
        }
        return [];
    }
从配置文件目录中加载
@param $name
@param bool $overwrite
@return mixed|null