Search code snippets, questions, articles...

Set HTTP response code in php

    $status_code = 201;
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place.

If you want to set response status code header in PHP, you can do that using http_response_code($status_code) function. This will return the status code from the HTTP request.

You can get information about status codes from below link

HTTP response codes

Was this helpful?