```php class Header { /** * 请求Header头信息 * @var array */ protected static $header = []; /** * 初始化请求Header头信息 * @return array */ protected static function getAll() { $headers = []; foreach ($_SERVER as $name => $value) { if (substr($name, 0, 5) == "HTTP_") { $headers[str_replace(" ", "-", ucwords(strtolower(str_replace("_", " ", substr($name, 5)))))] = $value; } } return $headers; } /** * 获取请求header参数 * @param $key * @param string $default * @return mixed|string */ public static function get($key, $default = "") { if (self::$header == null) { self::$header = self::getAll(); } return self::$header[$key] ?? $default; } } ```