多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
# Coroutine\Http2\Client `Http2`协程客户端。 实例 ---- ```php go(function () { $domain = 'www.zhihu.com'; $cli = new Swoole\Coroutine\Http2\Client($domain, 443, true); $cli->set([ 'timeout' => -1, 'ssl_host_name' => $domain ]); $cli->connect(); $req = new swoole_http2_request; $req->method = 'POST'; $req->path = '/api/v4/answers/300000000/voters'; $req->headers = [ 'host' => $domain, "user-agent" => 'Chrome/49.0.2587.3', 'accept' => 'text/html,application/xhtml+xml,application/xml', 'accept-encoding' => 'gzip' ]; $req->data = '{"type":"up"}'; $cli->send($req); $response = $cli->recv(); assert(json_decode($response->data)->error->code === 602); }); ```