From 22130526c8d86f3119f0a7d52a0b20269825f174 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Wed, 9 Sep 2020 19:08: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/Http/Context.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/HttpServer/Http/Context.php b/HttpServer/Http/Context.php index 2cfd8299..52f65d7b 100644 --- a/HttpServer/Http/Context.php +++ b/HttpServer/Http/Context.php @@ -64,14 +64,13 @@ class Context extends BaseContext if (!static::hasContext($id)) { Coroutine::getContext()[$id] = []; } - if (!empty($key)) { - if (!is_array(Coroutine::getContext()[$id])) { - Coroutine::getContext()[$id] = [$key => $context]; - } else { - Coroutine::getContext()[$id][$key] = $context; - } + if (empty($key)) { + return Coroutine::getContext()[$id] = $context; + } + if (!is_array(Coroutine::getContext()[$id])) { + Coroutine::getContext()[$id] = [$key => $context]; } else { - Coroutine::getContext()[$id] = $context; + Coroutine::getContext()[$id][$key] = $context; } return $context; }