From 89913158885e01173fd5463427b9378db5e5f652 Mon Sep 17 00:00:00 2001 From: JaguarJack Date: Wed, 14 Oct 2020 20:07:36 +0800 Subject: [PATCH] =?UTF-8?q?add:=E6=96=B0=E5=A2=9E=E5=BF=BD=E7=95=A5ssl?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/catcher/facade/Http.php | 1 + extend/catcher/library/client/Http.php | 54 +++++++++++++++++++++++--- 2 files changed, 50 insertions(+), 5 deletions(-) diff --git a/extend/catcher/facade/Http.php b/extend/catcher/facade/Http.php index 6e68099..0abfa77 100644 --- a/extend/catcher/facade/Http.php +++ b/extend/catcher/facade/Http.php @@ -15,6 +15,7 @@ use think\Facade; * @method static \catcher\library\client\Http put(string $url) * @method static \catcher\library\client\Http delete(string $url) * @method static \catcher\library\client\Http token(string $token) + * @method static \catcher\library\client\Http ignoreSsl() * @method static \catcher\library\client\Http attach($name, $resource, $filename) * * @time 2020年05月22日 diff --git a/extend/catcher/library/client/Http.php b/extend/catcher/library/client/Http.php index f87d363..b84f6a9 100644 --- a/extend/catcher/library/client/Http.php +++ b/extend/catcher/library/client/Http.php @@ -29,18 +29,39 @@ class Http */ protected $proxy = []; + /** + * body + * + * @var array + */ protected $body = []; - + /** + * header + * + * @var array + */ protected $header = []; - + /** + * form params + * + * @var array + */ protected $formParams = []; - + /** + * query set + * + * @var array + */ protected $query = []; - + /** + * json set + * + * @var array + */ protected $json = []; /** @@ -68,6 +89,14 @@ class Http protected $token = ''; protected $multipart = []; + + /** + * 忽略证书 + * + * @var array + */ + protected $ignoreSsl = []; + /** * 获取 Guzzle 客户端 * @@ -194,6 +223,20 @@ class Http return $this; } + /** + * 忽略 ssl 证书 + * + * @return $this + */ + public function ignoreSsl() + { + $this->ignoreSsl = [ + 'verify' => false, + ]; + + return $this; + } + /** * 可选参数 * @@ -265,7 +308,8 @@ class Http protected function merge() { return array_merge($this->header, $this->query, $this->timeout, - $this->options, $this->body, $this->auth, $this->multipart, $this->formParams + $this->options, $this->body, $this->auth, $this->multipart, $this->formParams, + $this->ignoreSsl ); }