add clear

This commit is contained in:
2020-11-16 16:26:06 +08:00
parent 943a233724
commit da349413c2
+7 -8
View File
@@ -195,7 +195,6 @@ class HttpClient
*/ */
public function setHost($host) public function setHost($host)
{ {
var_dump($host);
$this->host = $this->replaceHost($host); $this->host = $this->replaceHost($host);
$match_quest = '/^[a-zA-Z\-]+(\.[a-zA-Z\-])+/'; $match_quest = '/^[a-zA-Z\-]+(\.[a-zA-Z\-])+/';
if (preg_match($match_quest, $this->host)) { if (preg_match($match_quest, $this->host)) {
@@ -339,22 +338,22 @@ class HttpClient
return false; return false;
} }
if ($this->isHttp($string)) { if ($this->isHttp($_string)) {
$_string = str_replace('http://', '', $string); $_string = str_replace('http://', '', $_string);
$hostAndUrls = explode('/', $string); $hostAndUrls = explode('/', $_string);
$this->host = array_shift($hostAndUrls); $this->host = array_shift($hostAndUrls);
$_string = implode('/', $hostAndUrls); $_string = implode('/', $hostAndUrls);
} else if ($this->isHttps($string)) { } else if ($this->isHttps($_string)) {
$_string = str_replace('https://', '', $string); $_string = str_replace('https://', '', $_string);
$this->setIsSSL(true); $this->setIsSSL(true);
$hostAndUrls = explode('/', $string); $hostAndUrls = explode('/', $_string);
$this->host = array_shift($hostAndUrls); $this->host = array_shift($hostAndUrls);
$_string = implode('/', $hostAndUrls); $_string = implode('/', $hostAndUrls);
} else if (empty($this->host)) { } else if (empty($this->host)) {
$hostAndUrls = explode('/', $string); $hostAndUrls = explode('/', $_string);
$this->host = array_shift($hostAndUrls); $this->host = array_shift($hostAndUrls);
$_string = implode('/', $hostAndUrls); $_string = implode('/', $hostAndUrls);