From 7b13db2330e9e1fe25269e3b09597914b31a082c Mon Sep 17 00:00:00 2001 From: "as2252258@163.com" Date: Tue, 7 Jan 2020 12:02:55 +0800 Subject: [PATCH] add clear --- common/HttpClient.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/common/HttpClient.php b/common/HttpClient.php index 0411b4c..dbc7ca1 100644 --- a/common/HttpClient.php +++ b/common/HttpClient.php @@ -219,11 +219,14 @@ class HttpClient $data = $this->paramEncode($data); if ($this->use_swoole === false) { return $this->useCurl($url, $data); - } - if (function_exists('getIsCli') && getIsCli()) { + } else if ($this->use_swoole) { return $this->coroutine($this->parseUrlHost($url), $url, $data); + } else { + if (function_exists('getIsCli') && getIsCli()) { + return $this->coroutine($this->parseUrlHost($url), $url, $data); + } + return $this->useCurl($url, $data); } - return $this->useCurl($url, $data); } /** @@ -431,7 +434,6 @@ class HttpClient $data = new Result(['code' => 500, 'message' => curl_error($ch)]); } else { [$header, $body, $status] = $this->explode($output); - if ($status != 200) { $data = new Result(['code' => 500, 'message' => $body, 'header' => $header]); } else {