From d37abb41a87822b0ba8ccdc1ecb6cf6980925c77 Mon Sep 17 00:00:00 2001 From: rad168 <86744795+rad168@users.noreply.github.com> Date: Sun, 2 Feb 2025 07:08:12 +0800 Subject: [PATCH] Update mytv.php --- mytv/mytv.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/mytv/mytv.php b/mytv/mytv.php index f9d89ff..f021f2b 100644 --- a/mytv/mytv.php +++ b/mytv/mytv.php @@ -24,6 +24,19 @@ if (!$parsed_url || !isset($parsed_url['host']) || !in_array($parsed_url['host'] die('非法请求的域名'); } +//自定义 getallheaders() 函数,使得代码可以兼容 FastCGI 模式 +if (!function_exists('getallheaders')) { + function getallheaders() { + $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; + } +} + // 处理 HTTP 头信息 $headers = []; foreach (getallheaders() as $name => $value) {