解决方法有2个:
1、升级swoole的openssl版本;
2、代码中加入GuzzleHttp请求options参数中加上:‘handler’ => HandlerStack::create(new CoroutineHandler()),
<?php
use GuzzleHttp\Client;
use Hyperf\Guzzle\CoroutineHandler;
use GuzzleHttp\HandlerStack;
$client = new Client([
'base_uri' => 'http://127.0.0.1:8080',
'handler' => HandlerStack::create(new CoroutineHandler()),
'timeout' => 5,
'swoole' => [
'timeout' => 10,
'socket_buffer_size' => 1024 * 1024 * 2,
],
]);
$response = $client->get('/');
来源:https://blog.csdn.net/weixin_45275983/article/details/128018554