From 605aee35c49a3f5085567b1b02b646451bfc17e1 Mon Sep 17 00:00:00 2001 From: kuaifan Date: Thu, 13 Jan 2022 11:42:01 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E5=8F=91=E9=80=81=E6=96=87=E4=BB=B6ws?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E9=94=99=E8=AF=AF=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Module/Base.php | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/app/Module/Base.php b/app/Module/Base.php index e0dc9f5a..ca4ff82f 100755 --- a/app/Module/Base.php +++ b/app/Module/Base.php @@ -743,11 +743,7 @@ class Base ) { return $str; } else { - try { - return url($str); - } catch (\Throwable $e) { - return self::getSchemeAndHost() . "/" . $str; - } + return Base::leftDelete(url($str), "http://localhost"); } } @@ -764,24 +760,10 @@ class Base } return $str; } - try { - $find = url(''); - } catch (\Throwable $e) { - $find = self::getSchemeAndHost(); - } + $find = url(''); return Base::leftDelete($str, $find . '/'); } - /** - * 获取主地址 - * @return string 如:http://127.0.0.1:8080 - */ - public static function getSchemeAndHost() - { - $scheme = isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == '443' ? 'https://' : 'http://'; - return $scheme.($_SERVER['HTTP_HOST'] ?? ''); - } - /** * 格式化内容图片地址 * @param $content