From 779cccd331637cfe18ef7ad56bc66c54ce8314a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Fri, 15 Sep 2023 15:54:52 +0800 Subject: [PATCH] eee --- src/Base/NotFoundController.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Base/NotFoundController.php b/src/Base/NotFoundController.php index e493379..1a23559 100644 --- a/src/Base/NotFoundController.php +++ b/src/Base/NotFoundController.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace Kiri\Router\Base; +use Kiri\Di\Context; use Psr\Http\Message\ResponseInterface; class NotFoundController extends Controller @@ -15,10 +16,12 @@ class NotFoundController extends Controller */ public function fail(): ResponseInterface { + $response = Context::get(ResponseInterface::class); if ($this->request->getMethod() == 'OPTIONS') { - return \response()->withStatus(200, ""); + return $response->withStatus(200, ""); + } else { + return $response->withStatus(404, "not found page."); } - return \response()->withStatus(404, "not found page."); } }