From c995bb7e51d6d71d03c447db8abe20b8e5121a58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Wed, 25 Aug 2021 11:25:49 +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 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/http-helper/Route/Router.php b/http-helper/Route/Router.php index 353866fe..2fcc9b2d 100644 --- a/http-helper/Route/Router.php +++ b/http-helper/Route/Router.php @@ -445,6 +445,9 @@ class Router extends HttpService implements RouterInterface foreach ($this->nodes as $node) { /** @var Node[] $node */ foreach ($node as $_node) { + if (!empty($_node->sourcePath)) { + $path[] = ['method' => $_node->method, 'path' => $_node->sourcePath]; + } $paths = $this->getChildes($_node, $paths); } } @@ -460,7 +463,7 @@ class Router extends HttpService implements RouterInterface private function getChildes(Node $node, array $path): array { foreach ($node->childes as $item) { - if (!empty($_node->sourcePath)) { + if (!empty($item->sourcePath)) { $path[] = ['method' => $item->method, 'path' => $item->sourcePath]; } if (!empty($item->childes)) {