From 39865db17af64291518e413a10d46f3e4ef6893e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 6 Jul 2021 17:36:26 +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 cafabd81..0cb99456 100644 --- a/function.php +++ b/function.php @@ -17,6 +17,7 @@ use JetBrains\PhpStorm\Pure; use Snowflake\Abstracts\Config; use Snowflake\Application; use Snowflake\Core\ArrayAccess; +use Snowflake\Core\Json; use Snowflake\Error\Logger; use Snowflake\Event; use Snowflake\Exception\ConfigException; @@ -644,12 +645,14 @@ if (!function_exists('send')) { /** * @param $context - * @param $statusCode + * @param int $statusCode * @return mixed * @throws Exception */ - function send($context, $statusCode = 404): mixed + function send($context, int $statusCode = 404): mixed { + if (is_array($context)) $context = Json::encode($context); + return \response()->send($context, $statusCode); }