From e5d97e5a29cfc4cea16d7e37391759a767b07093 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 3 Aug 2021 11:55:12 +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 --- HttpServer/Route/Router.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/HttpServer/Route/Router.php b/HttpServer/Route/Router.php index 6daca769..ec3de876 100644 --- a/HttpServer/Route/Router.php +++ b/HttpServer/Route/Router.php @@ -120,7 +120,7 @@ class Router extends HttpService implements RouterInterface if ($handler instanceof Closure) { $handler = Closure::bind($handler, di(Controller::class)); } - return $this->hash($path, $handler, $method); + return $this->tree($path, $handler, $method); } @@ -278,7 +278,7 @@ class Router extends HttpService implements RouterInterface public function any($route, $handler): Any { $nodes = []; - foreach (['GET', 'POST', 'OPTIONS', 'PUT', 'DELETE', 'HEAD'] as $method) { + foreach ($this->methods as $method) { $nodes[] = $this->addRoute($route, $handler, $method); } return new Any($nodes); @@ -515,7 +515,7 @@ class Router extends HttpService implements RouterInterface */ public function dispatch(Request $request): void { - $node = $this->find_path($request); + $node = $this->Branch_search($request); if (!($node instanceof Node)) { $this->response->setFormat(Response::HTML); $this->response->send('

404

');