From 64366a684a03ff5c10bf773d80eb0e69ab034913 Mon Sep 17 00:00:00 2001 From: Anyon <zoujingli@qq.com> Date: Thu, 7 Jun 2018 17:41:23 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=9B=B4=E6=96=B0]=E4=BF=AE=E6=94=B9=E6=9C=AC?= =?UTF-8?q?=E5=9C=B0=E6=96=87=E4=BB=B6=E4=B8=8A=E4=BC=A0=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/service/FileService.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extend/service/FileService.php b/extend/service/FileService.php index f3f4a20e1..c0e85806a 100644 --- a/extend/service/FileService.php +++ b/extend/service/FileService.php @@ -156,8 +156,9 @@ class FileService */ public static function getBaseUriLocal() { - $appRoot = request()->root(true); // 如果你想获取相对url地址,这里去掉参数 true + $appRoot = request()->root(true); // 去掉参数 true 将获得相对地址 $uriRoot = preg_match('/\.php$/', $appRoot) ? dirname($appRoot) : $appRoot; + $uriRoot = in_array($uriRoot, ['/', '\\']) ? '' : $uriRoot; return "{$uriRoot}/static/upload/"; }