From 8f37ccb79455986d1557ce34a1f7b6d1e0168bc3 Mon Sep 17 00:00:00 2001 From: xucong <850806214@qq.com> Date: Mon, 12 May 2025 17:21:54 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=8F=90=E4=BA=A4=E7=BC=BA=E5=A4=B1=E7=9A=84?= =?UTF-8?q?=E4=B8=9C=E8=A5=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/service/UrlServer.php | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/app/common/service/UrlServer.php b/app/common/service/UrlServer.php index 3ca99de..beabe5b 100644 --- a/app/common/service/UrlServer.php +++ b/app/common/service/UrlServer.php @@ -57,18 +57,22 @@ class UrlServer } $protocol = is_https() ? 'https://' : 'http://'; - $file_url = config('project.file_domain'); - if ($file_url[strlen($file_url) - 1] == '/') { - $file_url = substr($file_url,0,strlen($file_url)-1); - - $port = request()->port(); - $port = in_array($port, [ '80', '443' ]) ? '' : ":{$port}"; - - $file_url .= $port; - } - - return $protocol . $file_url . $uri; + $file_url = config('project.file_domain'); + +// if ($file_url[strlen($file_url) - 1] == '/') { +// $file_url = substr($file_url,0,strlen($file_url)-1); +// +// $port = request()->port(); +// $port = in_array($port, [ '80', '443' ]) ? '' : ":{$port}"; +// +// $file_url .= $port; +// } + +// return $protocol . $file_url . $uri; + $domain = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://"; + $domain .= $_SERVER['HTTP_HOST']; + return $domain.$uri; } else { $config = ConfigServer::get('storage_engine',$engine);