From f3582527a7e36b470a45dc9f2eb709aa28b53be7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 23 Feb 2021 14:26:10 +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/Node.php | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/HttpServer/Route/Node.php b/HttpServer/Route/Node.php index 76f42690..a04f409a 100644 --- a/HttpServer/Route/Node.php +++ b/HttpServer/Route/Node.php @@ -56,16 +56,6 @@ class Node extends HttpService private array $_after = []; private array $_limits = []; - - /** - * @throws ComponentException - * @throws Exception - */ - public function init() - { - listen(Event::SERVER_AFTER_WORKER_START, [$this, 'restructure']); - } - /** * @param $handler * @return Node @@ -460,9 +450,10 @@ class Node extends HttpService */ public function dispatch(): mixed { - if (empty($this->callback)) { + if (empty($this->callback) && $this->restructure()) { return Json::to(404, $node->_error ?? 'Page not found.'); } + $requestParams = func_get_args(); if (func_num_args() > 0) { return call_user_func($this->callback, ...$requestParams);