From 1956cc64ae0ad69d8276b75ecb66e7720cca0c03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Sat, 18 Sep 2021 10:48:25 +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 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/http-helper/Route/Router.php b/http-helper/Route/Router.php index e507394c..9fc520af 100644 --- a/http-helper/Route/Router.php +++ b/http-helper/Route/Router.php @@ -8,6 +8,7 @@ use Closure; use Exception; use Http\Abstracts\HttpService; use Http\Controller; +use Http\Handler\Abstracts\HandlerManager; use Http\IInterface\MiddlewareInterface; use Http\IInterface\RouterInterface; use JetBrains\PhpStorm\Pure; @@ -103,6 +104,14 @@ class Router extends HttpService implements RouterInterface if ($handler instanceof Closure) { $handler = Closure::bind($handler, di(Controller::class)); } + + $path = $this->addPrefix() . '/' . ltrim($path, '/'); + + + + HandlerManager::add($path, $method, $handler); + + return null; return $this->tree($path, $handler, $method); }