add clear

This commit is contained in:
2020-04-03 17:37:19 +08:00
parent 2d37e4e6d7
commit d8cae08cb0
+2 -5
View File
@@ -8,7 +8,7 @@ use Swoole\Coroutine\System;
class HttpClient class HttpClient
{ {
private $host = 'api.weixin.qq.com'; private $host = '';
private $header = []; private $header = [];
@@ -317,7 +317,7 @@ class HttpClient
*/ */
private function parseUrlHost($url) private function parseUrlHost($url)
{ {
if (strpos($this->host, $url) === false) { if (!empty($this->host) && strpos($this->host, $url) === false) {
$url = rtrim($this->host, '/') . '/' . ltrim($url, '/'); $url = rtrim($this->host, '/') . '/' . ltrim($url, '/');
} }
if (!$this->isHttp($url) && !$this->isHttps($url)) { if (!$this->isHttp($url) && !$this->isHttps($url)) {
@@ -339,7 +339,6 @@ class HttpClient
{ {
$url = $this->replaceHost($url); $url = $this->replaceHost($url);
$explode = explode('/', $url); $explode = explode('/', $url);
var_dump($explode);
$first = array_shift($explode); $first = array_shift($explode);
if (strpos($first, ':') !== false) { if (strpos($first, ':') !== false) {
[$first, $this->port] = explode(':', $first); [$first, $this->port] = explode(':', $first);
@@ -348,8 +347,6 @@ class HttpClient
} }
} }
$url = '/' . implode('/', $explode); $url = '/' . implode('/', $explode);
var_dump($first, $url, $explode);
return [$first, $url]; return [$first, $url];
} }