From ee892ef350ae3e7267409b1b72d7898344ee823e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=80=A1=E6=A0=8B?= Date: Tue, 12 Oct 2021 13:02:39 +0800 Subject: [PATCH] * fix for api. --- framework/api/router.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/api/router.class.php b/framework/api/router.class.php index 3b18de79fd..1df2e0b4e0 100644 --- a/framework/api/router.class.php +++ b/framework/api/router.class.php @@ -88,11 +88,11 @@ class api extends router } else { - $this->path = trim((strpos($_SERVER['REQUEST_URI'], '?') > 0 ? strstr($_SERVER['REQUEST_URI'], '?', true) : $_SERVER['REQUEST_URI']), '/'); + $this->path = rtrim((strpos($_SERVER['REQUEST_URI'], '?') > 0 ? strstr($_SERVER['REQUEST_URI'], '?', true) : $_SERVER['REQUEST_URI']), '/'); } $dir = rtrim(dirname($_SERVER['SCRIPT_NAME']), '/'); - if($dir != '') $this->path = substr($this->path, strlen($dir)); + if($dir != '' and strpos($this->path, $dir) === 0) $this->path = substr($this->path, strlen($dir)); $subPos = strpos($this->path, '/', 1);