From 09a466fdf48ac70fa4b037ef35b73d6b7c2241dc Mon Sep 17 00:00:00 2001 From: "as2252258@163.com" Date: Wed, 21 Apr 2021 01:43:37 +0800 Subject: [PATCH] modify --- HttpServer/Route/Dispatch/Dispatch.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/HttpServer/Route/Dispatch/Dispatch.php b/HttpServer/Route/Dispatch/Dispatch.php index db51501d..f46b868f 100644 --- a/HttpServer/Route/Dispatch/Dispatch.php +++ b/HttpServer/Route/Dispatch/Dispatch.php @@ -36,11 +36,6 @@ class Dispatch { $class = new static(); $class->handler = $handler; - $dispatchParam = Context::getContext('dispatch-param'); - if (empty($dispatchParam)) { - $dispatchParam = [\request()]; - } - $class->request = $dispatchParam; if ($handler instanceof Closure) { $class->bind(); } @@ -57,7 +52,12 @@ class Dispatch public function dispatch(): mixed { // return call_user_func($this->handler, $this->request); - return \aop($this->handler, ...$this->request); + + $dispatchParam = Context::getContext('dispatch-param'); + if (empty($dispatchParam)) { + $dispatchParam = [\request()]; + } + return \aop($this->handler, $dispatchParam); }