From 4e8b213728a739aa6087f330d5dc29e431469756 Mon Sep 17 00:00:00 2001 From: xiaoz Date: Sun, 25 Oct 2020 19:38:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DDocker=E7=89=88=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E7=94=9F=E6=88=90=E6=96=87=E4=BB=B6=E7=B4=A2=E5=BC=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- functions/cache.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/functions/cache.php b/functions/cache.php index 3796de5..e7b72c6 100644 --- a/functions/cache.php +++ b/functions/cache.php @@ -86,8 +86,14 @@ function get_url(){ } //$uri = str_replace("cache.php","",$uri); - //组合为完整的URL - $domain = $protocol.$_SERVER['HTTP_HOST'].$port.$uri; + //如果主机名是localhost,则获取localhost + if( $_SERVER['SERVER_NAME'] == 'localhost' ) { + $domain = $protocol.$_SERVER['SERVER_NAME'].$port.$uri; + } + else { + $domain = $protocol.$_SERVER['HTTP_HOST'].$port.$uri; + } + return $domain; } ?>