-
Notifications
You must be signed in to change notification settings - Fork 1
ServerRequest: withParsedBody Example
Terry L edited this page Jun 20, 2020
·
3 revisions
Shieldon\Psr7\ServerRequest
Extends Request.
Return an instance with the specified body parameters.
-
param
null|array|object
$data*
The deserialized body data. -
return
static
Example:
$serverRequest = $serverRequest->withParsedBody(
[
'foo' => 'bar',
'yes' => 'I do'
]
);
$parsedBody = $serverRequest->getParsedBody();
echo $parsedBody['yes'];
// Outputs: I do
composer require shieldon/psr-http
Shieldon PSR HTTP implementation written by Terry L. from Taiwan.