You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
885 B
46 lines
885 B
3 years ago
|
<?php
|
||
|
/*
|
||
|
* @Author: witersen
|
||
|
* @Date: 2022-05-06 15:34:14
|
||
|
* @LastEditors: witersen
|
||
|
* @LastEditTime: 2022-05-07 11:55:55
|
||
|
* @Description: QQ:1801168257
|
||
|
*/
|
||
|
|
||
|
class Config
|
||
|
{
|
||
|
/**
|
||
|
* 配置文件目录
|
||
|
*
|
||
|
* @var string
|
||
|
*/
|
||
|
public static $_configPath = '';
|
||
|
|
||
|
/**
|
||
|
* 自动include
|
||
|
*
|
||
|
* @param string $configPath
|
||
|
* @return void
|
||
|
*/
|
||
|
public static function load($configPath)
|
||
|
{
|
||
|
self::$_configPath = $configPath;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 获取配置信息value
|
||
|
*
|
||
|
* @param string $section
|
||
|
* @param array $default
|
||
|
* @return array
|
||
|
*/
|
||
|
public static function get($section = null, $default = [])
|
||
|
{
|
||
|
if (is_file(self::$_configPath . $section . '.php')) {
|
||
|
$config = include self::$_configPath . $section . '.php';
|
||
|
return $config;
|
||
|
}
|
||
|
return $default;
|
||
|
}
|
||
|
}
|