Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You may use the following function to send a status change:</p> <pre><code>function header_status($statusCode) { static $status_codes = null; if ($status_codes === null) { $status_codes = array ( 100 =&gt; 'Continue', 101 =&gt; 'Switching Protocols', 102 =&gt; 'Processing', 200 =&gt; 'OK', 201 =&gt; 'Created', 202 =&gt; 'Accepted', 203 =&gt; 'Non-Authoritative Information', 204 =&gt; 'No Content', 205 =&gt; 'Reset Content', 206 =&gt; 'Partial Content', 207 =&gt; 'Multi-Status', 300 =&gt; 'Multiple Choices', 301 =&gt; 'Moved Permanently', 302 =&gt; 'Found', 303 =&gt; 'See Other', 304 =&gt; 'Not Modified', 305 =&gt; 'Use Proxy', 307 =&gt; 'Temporary Redirect', 400 =&gt; 'Bad Request', 401 =&gt; 'Unauthorized', 402 =&gt; 'Payment Required', 403 =&gt; 'Forbidden', 404 =&gt; 'Not Found', 405 =&gt; 'Method Not Allowed', 406 =&gt; 'Not Acceptable', 407 =&gt; 'Proxy Authentication Required', 408 =&gt; 'Request Timeout', 409 =&gt; 'Conflict', 410 =&gt; 'Gone', 411 =&gt; 'Length Required', 412 =&gt; 'Precondition Failed', 413 =&gt; 'Request Entity Too Large', 414 =&gt; 'Request-URI Too Long', 415 =&gt; 'Unsupported Media Type', 416 =&gt; 'Requested Range Not Satisfiable', 417 =&gt; 'Expectation Failed', 422 =&gt; 'Unprocessable Entity', 423 =&gt; 'Locked', 424 =&gt; 'Failed Dependency', 426 =&gt; 'Upgrade Required', 500 =&gt; 'Internal Server Error', 501 =&gt; 'Not Implemented', 502 =&gt; 'Bad Gateway', 503 =&gt; 'Service Unavailable', 504 =&gt; 'Gateway Timeout', 505 =&gt; 'HTTP Version Not Supported', 506 =&gt; 'Variant Also Negotiates', 507 =&gt; 'Insufficient Storage', 509 =&gt; 'Bandwidth Limit Exceeded', 510 =&gt; 'Not Extended' ); } if ($status_codes[$statusCode] !== null) { $status_string = $statusCode . ' ' . $status_codes[$statusCode]; header($_SERVER['SERVER_PROTOCOL'] . ' ' . $status_string, true, $statusCode); } } </code></pre> <p>You may use it as such:</p> <pre><code>&lt;?php header_status(500); if (that_happened) { die("that happened") } if (something_else_happened) { die("something else happened") } update_database(); header_status(200); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload