From f6ff7613fa12069e2e2c0c11a82bf48e1cf431e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Wed, 16 Sep 2020 21:09:45 +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 | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/HttpServer/Route/Router.php b/HttpServer/Route/Router.php index 37051fcc..19db1283 100644 --- a/HttpServer/Route/Router.php +++ b/HttpServer/Route/Router.php @@ -455,7 +455,7 @@ class Router extends Application implements RouterInterface * @return Node|false|int|mixed|string|null * 树干搜索 */ - private function find_path($request) + private function find_path(Request $request) { $method = $request->getMethod(); if (!isset($this->nodes[$method])) { @@ -463,13 +463,13 @@ class Router extends Application implements RouterInterface } $methods = $this->nodes[$method]; $uri = $request->headers->get('request_uri', '/'); - if (!isset($methods[$uri])) { - if ($request->isOption && !isset($methods['/'])) { - return null; - } - return $this->nodes[$method]['/']; + if (isset($methods[$uri])) { + return $methods[$uri]; } - return $this->nodes[$method][$uri]; + if (!$request->isOption || !isset($methods['/'])) { + return null; + } + return $methods['/']; }