From 15185405fb5d39e0b4a23be1aa7400441fa7a1ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Mon, 30 Aug 2021 17:10:58 +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, 4 insertions(+), 3 deletions(-) diff --git a/http-helper/Route/Router.php b/http-helper/Route/Router.php index d10d0da3..3342ea4e 100644 --- a/http-helper/Route/Router.php +++ b/http-helper/Route/Router.php @@ -393,13 +393,14 @@ class Router extends HttpService implements RouterInterface * @param $method * @return Node|null * 查找指定路由 + * @throws Exception */ - public function tree_search(?array $explode, $method): ?Node + public function tree_search(?array $explode): ?Node { - if (!isset($this->nodes[$method])) { + if (!isset($this->nodes['/'])) { return null; } - $parent = $this->nodes[$method]['/']; + $parent = $this->nodes['/']; while ($value = array_shift($explode)) { $node = $parent->findNode($value); if (!$node) {