From 690d3f423d95ed610422e9c2e29e61751f5c36ab Mon Sep 17 00:00:00 2001 From: Unknown Date: Mon, 25 Dec 2017 11:23:07 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=BD=93=E7=BD=91=E9=A1=B5=E7=BD=91?= =?UTF-8?q?=E5=9D=80=E6=9C=AB=E5=B0=BE=E6=98=AF`/`=E7=9A=84=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E5=BD=A2=E5=BC=8F=E6=97=B6=EF=BC=8C=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?url=E8=B7=AF=E5=BE=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 如果最后一个/后无字符,dirname 命令使用倒数第二个/,添加个字符a使其使用最后一个/ --- src/Lib/Helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Lib/Helper.php b/src/Lib/Helper.php index 30042d4..76bf02e 100644 --- a/src/Lib/Helper.php +++ b/src/Lib/Helper.php @@ -61,7 +61,7 @@ public static function formatUrl($l1, $l2) if (strlen($l3) == 0) { return $l1; } - $path = dirname($url_parsed['path']); + $path = dirname($url_parsed['path'].'a'); if ($path[0] == '\\') { $path = ''; } From 610835fb104a970ccfef679a09a8f218f635966c Mon Sep 17 00:00:00 2001 From: Unknown Date: Mon, 25 Dec 2017 11:31:04 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=BD=93=E7=BD=91=E9=A1=B5=E7=BD=91?= =?UTF-8?q?=E5=9D=80=E6=9C=AB=E5=B0=BE=E6=98=AF`/`=E7=9A=84=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E5=BD=A2=E5=BC=8F=E6=97=B6=EF=BC=8C=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?url=E8=B7=AF=E5=BE=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 如果最后一个/后无字符,dirname 命令使用倒数第二个/,添加个字符a使其使用最后一个/ --- src/Lib/Helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Lib/Helper.php b/src/Lib/Helper.php index 76bf02e..fd7ebd4 100644 --- a/src/Lib/Helper.php +++ b/src/Lib/Helper.php @@ -79,7 +79,7 @@ public static function formatUrl($l1, $l2) while (substr($I1, 0, 3) == '../') { $I1 = substr($I1, strlen($I1) - (strlen($I1) - 3), strlen($I1) - 3); if (strlen($path) > 0) { - $path = dirname($path); + $path = dirname($path.'a'); } } return $I1 = $path == '/' ? $l3 . $path . $I1 : $l3 . $path . "/" . $I1;