add clear

This commit is contained in:
2020-11-25 16:26:42 +08:00
parent f6b89da482
commit f174d9450e
+4 -3
View File
@@ -623,7 +623,7 @@ class HttpClient
private function curl($url, $data = []) private function curl($url, $data = [])
{ {
try { try {
$output = $this->curlParse($url, $this->mergeParams($data)); $output = $this->curlParse($url, $data);
if ($output === FALSE) { if ($output === FALSE) {
return new Result(['code' => 500, 'message' => $output]); return new Result(['code' => 500, 'message' => $output]);
} }
@@ -680,9 +680,10 @@ class HttpClient
if ($this->method == self::POST) { if ($this->method == self::POST) {
curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POST, 1);
} }
if ($this->method == self::GET || !empty($this->_data)) {
if ($this->method != self::GET) {
curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
} else {
curl_setopt($ch, CURLOPT_POSTFIELDS, $this->mergeParams($data));
} }
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, strtoupper($this->method)); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, strtoupper($this->method));