I have a PHP Code that want to create responses with HTTP response codes (status-codes) in API, like HTTP 200 OK, or some 4XX or 5XX response code.
How I can do this using PHP?
If you want to return a custom response using the HTTP response code in your page, use the following PHP code:
For example, if you want to return a 404 code response, use code like this:
If you still have a question about this, submit it in our Q&A community - Ask Question