Method
MultipartStream::__construct
Create the body from the fields.
Description#
public MultipartStream::__construct(
array $fields,
?string $boundary = null
)Parameters#
- $fields array
- Field name to value: a scalar, a Stringable, a stream resource, an SplFileInfo, or a nested array
- $boundary ?string = null
- The boundary string; random when null
Examples#
$body = new MultipartStream(['name' => 'Frode', 'files' => [\fopen('a.txt', 'r'), \fopen('b.txt', 'r')]]);See also#
MultipartStream::getContentTypeReturn theContent-Typeheader value,multipart/form-datawith this body's boundary.