add clear

This commit is contained in:
2021-04-06 15:49:46 +08:00
parent 74960d1df1
commit 50773cefad
+9 -7
View File
@@ -332,31 +332,31 @@ class HttpClient
* @return bool|string
* @throws Exception
*/
private function matchHost($_string= '')
private function matchHost($_string = '')
{
if (empty($_string)) {
return false;
}
if ($this->isHttp($_string)) {
$_= str_replace('http://', '', $_string);
$_ = str_replace('http://', '', $_string);
$hostAndUrls = explode('/', $_string);
$this->host = array_shift($hostAndUrls);
$_= implode('/', $hostAndUrls);
$_ = implode('/', $hostAndUrls);
} else if ($this->isHttps($_string)) {
$_= str_replace('https://', '', $_string);
$_ = str_replace('https://', '', $_string);
$this->setIsSSL(true);
$hostAndUrls = explode('/', $_string);
$this->host = array_shift($hostAndUrls);
$_= implode('/', $hostAndUrls);
$_ = implode('/', $hostAndUrls);
} else if (empty($this->host)) {
$hostAndUrls = explode('/', $_string);
$this->host = array_shift($hostAndUrls);
$_= implode('/', $hostAndUrls);
$_ = implode('/', $hostAndUrls);
}
if (strpos($this->host, ':') !== false) {
@@ -692,7 +692,9 @@ class HttpClient
}
if ($this->method === self::POST) {
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $this->mergeParams($data));
if (!is_string($data)) {
curl_setopt($ch, CURLOPT_POSTFIELDS, $this->mergeParams($data));
}
}
$output = curl_exec($ch);