-
Notifications
You must be signed in to change notification settings - Fork 2
Response: withStatus Example
Terry L edited this page Jun 20, 2020
·
3 revisions
Shieldon\Psr7\Message\Response
Extends Message.
Return an instance with the specified status code and, optionally, reason phrase.
-
param
string
code*
The 3-digit integer result code to set. -
param
string
reasonPhrase= ""
The reason phrase to use with the provided status code -
return
static
Example:
$response = $response->withStatus(599, 'Something went wrong.');
echo $response->getStatusCode();
// Outputs: 599
echo $response->getReasonPhrase();
// Outputs: Something went wrong.
composer require shieldon/psr-http
Shieldon PSR HTTP implementation written by Terry L. from Taiwan.