stream

摘要

设置成 true 流响应,而非下载响应。

类型

bool

默认值

false

常量

GuzzleHttp\RequestOptions::STREAM

1. $response = $client->request('GET', '/stream/20', ['stream' => true]);
2. // Read bytes off of the stream until the end of the stream is reached
3. $body = $response->getBody();
4. while (!$body->eof()) {
5. echo $body->read(1024);
6. }