-
Notifications
You must be signed in to change notification settings - Fork 1
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
stringcode*The 3-digit integer result code to set. -
param
stringreasonPhrase= ""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-httpShieldon PSR HTTP implementation written by Terry L. from Taiwan.
