Search code snippets, questions, articles...

Set HTTP response code in php

    $status_code = 201;

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?
Programming Feeds
Learn something new everyday on Devsheet