response()->withHeader("Content-Type", "application/json") ->withStatus(200) ->withBody(new SwooleStream(json_encode($this->return->error('路由不存在'), JSON_UNESCAPED_UNICODE))); } /** * 405重写 * @param array $methods * @param ServerRequestInterface $request * @return ResponseInterface */ protected function handleMethodNotAllowed(array $methods, ServerRequestInterface $request): ResponseInterface { return $this->response()->withHeader("Content-Type", "application/json") ->withStatus(200) ->withBody(new SwooleStream(json_encode($this->return->error('路由请求方法不正确'), JSON_UNESCAPED_UNICODE))); } }