Sometimes, we want to send HTTP response code with PHP.
In this article, we’ll look at how to send HTTP response code with PHP.
How to send HTTP response code with PHP?
To send HTTP response code with PHP, we call the http_response_code
function.
For instance, we write
http_response_code(404);
to call http_response_code
with 404 to send a 404 response to the client.
Conclusion
To send HTTP response code with PHP, we call the http_response_code
function.