class YfyRawResponse

Class YfyRawResponse

Properties

protected array $headers
protected StreamInterface $body
protected int $httpResponseCode

Methods

__construct(string|array $headers, StreamInterface $body, int $httpStatusCode = null)

YfyRawResponse constructor.

array
getHeaders()

获取header数组

StreamInterface
getBody()

获取返回的流

int
getHttpResponseCode()

获取返回的status code

setHeadersFromString(string $rawHeaders)

将返回的string解析为header数组

saveToFile(string $savePath)

将请求返回结果存储为文件(通常用于下载文件)

createDownloadFile()

将请求返回结果以DownloadFile的形式返回给用户

Details

at line 40
__construct(string|array $headers, StreamInterface $body, int $httpStatusCode = null)

YfyRawResponse constructor.

Parameters

string|array $headers 请求返回的header数组
StreamInterface $body 请求返回的流
int $httpStatusCode 请求返回的status code

at line 60
array getHeaders()

获取header数组

Return Value

array

at line 70
StreamInterface getBody()

获取返回的流

Return Value

StreamInterface

at line 80
int getHttpResponseCode()

获取返回的status code

Return Value

int

at line 101
protected setHeadersFromString(string $rawHeaders)

将返回的string解析为header数组

Parameters

string $rawHeaders The raw headers from the response.

at line 129
saveToFile(string $savePath)

将请求返回结果存储为文件(通常用于下载文件)

Parameters

string $savePath 存储文件的路径,可以是文件夹,也可以是文件名

at line 146
DownloadFile createDownloadFile()

将请求返回结果以DownloadFile的形式返回给用户

Return Value

DownloadFile