Retrieves the status code for the current web response.
public getStatusCode ( ) : integer | ||
return | integer | Status code |
use Symfony\Component\HttpFoundation\Response; $response = new Response('Page not found', 404); $statusCode = $response->getStatusCode(); // 404
use Symfony\Component\HttpFoundation\Response; $response = new Response(); $response->setStatusCode(200); $statusCode = $response->getStatusCode(); // 200In this example, we create a new `Response` object and set the status code to 200 using the `setStatusCode` method. We then call the `getStatusCode` method to get the status code of the response. Package Library: `symfony/http-foundation`
public getStatusCode ( ) : integer | ||
return | integer | Status code |