From 6836a8672e76ff80c7e2a5bab9ae64b2f8539f28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Wed, 8 Sep 2021 15:31:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- http-helper/Route/Router.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/http-helper/Route/Router.php b/http-helper/Route/Router.php index 59db754f..c9003f06 100644 --- a/http-helper/Route/Router.php +++ b/http-helper/Route/Router.php @@ -401,11 +401,8 @@ class Router extends HttpService implements RouterInterface */ public function tree_search(?array $explode): ?Node { - if (empty($this->nodes)) { - return null; - } - $parent = $this->nodes[$explode] ?? null; - if (!($parent instanceof Node)) { + $parent = $this->nodes[array_shift($explode)] ?? null; + if (is_null($parent)) { return null; } while ($value = array_shift($explode)) {