response()->withStatus(404)->withBody(new SwooleStream('404 Not Found')); } /** * Handle the response when the routes found but doesn't match any available methods. * * @return array|Arrayable|mixed|ResponseInterface|string */ protected function handleMethodNotAllowed(array $methods, ServerRequestInterface $request): mixed { // 重写 HTTP 方法不允许的处理逻辑 return $this->response()->withStatus(405)->withBody(new SwooleStream('Method Error')); } }