From b61c20919542d7ca3901ee3861486c7cc15a9428 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Fri, 5 Mar 2021 13:58:40 +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 --- HttpServer/Http/Response.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/HttpServer/Http/Response.php b/HttpServer/Http/Response.php index 7c24e81d..2fc77536 100644 --- a/HttpServer/Http/Response.php +++ b/HttpServer/Http/Response.php @@ -163,6 +163,9 @@ class Response extends HttpService if ($this->response instanceof SResponse) { return $this->sendData($sendData, $statusCode); } else { + if (!empty(request()->fd)) { + return ''; + } return $this->printResult($sendData); } } @@ -275,8 +278,9 @@ class Response extends HttpService * @param int $offset * @param int $limit * @param int $sleep + * @return string */ - public function sendFile(string $path, $offset = 0, $limit = 1024000, $sleep = 0) + public function sendFile(string $path, $offset = 0, $limit = 1024000, $sleep = 0): string { $open = fopen($path, 'r'); @@ -302,6 +306,8 @@ class Response extends HttpService $this->response->end(); $this->response = null; + + return ''; }