From 13888f743012454ef9eacf5de902adcb73eef9df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Fri, 7 May 2021 11:10:47 +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 --- function.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/function.php b/function.php index 937cb5cf..10dc37c2 100644 --- a/function.php +++ b/function.php @@ -4,7 +4,6 @@ defined('APP_PATH') or define('APP_PATH', realpath(__DIR__ . '/../../')); use Annotation\Annotation; -use Annotation\Attribute; use HttpServer\Http\Context; use HttpServer\Http\HttpParams; use HttpServer\Http\Request; @@ -458,7 +457,11 @@ if (!function_exists('request')) { */ function request(): Request { - return Context::getContext('request'); + $request = Context::getContext('request'); + if ($request === null) { + $request = make('request', Request::class); + } + return $request; } }