ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# Coroutine\Http\Client->get 发起`GET`请求,函数原型: ```php function Swoole\Coroutine\Http\Client->get(string $path); ``` * $path 设置URL路径,如`/index.html`,注意这里不能传入`http://domain` * 使用get会忽略`setMethod`设置的请求方法,强制使用`GET` 使用实例 ---- ```php $cli = new Swoole\Coroutine\Http\Client('127.0.0.1', 80); $cli->setHeaders([ 'Host' => "localhost", "User-Agent" => 'Chrome/49.0.2587.3', 'Accept' => 'text/html,application/xhtml+xml,application/xml', 'Accept-Encoding' => 'gzip', ]); $cli->get('/index.php'); echo $cli->body; $cli->close(); ```