note 59392 deleted from function.header by mazzanet
| From: | mazzanet@php.net | Date: | Tue, 03 Jan 2006 09:58:54 +0000 |
| Subject: | note 59392 deleted from function.header by mazzanet | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-101134@lists.php.net to get a copy of this message | ||
Note Submitter: per dot eckerdal dot I_DISLIKE_SPAM at gmail dot com
----
When creating a system that does all the work of showing error pages, you might find this piece of
code useful:
<?php
$errcodes[400] = 'HTTP/1.1 400 Bad Request';
$errcodes[401] = 'HTTP/1.1 401 Unauthorized';
$errcodes[402] = 'HTTP/1.1 402 Payment Required';
$errcodes[403] = 'HTTP/1.1 403 Forbidden';
$errcodes[404] = 'HTTP/1.1 404 Not Found';
$errcodes[405] = 'HTTP/1.1 405 Method Not Allowed';
$errcodes[406] = 'HTTP/1.1 406 Not Acceptable';
$errcodes[407] = 'HTTP/1.1 407 Proxy Authentication Required';
$errcodes[408] = 'HTTP/1.1 408 Request Timeout';
$errcodes[409] = 'HTTP/1.1 409 Conflict';
$errcodes[410] = 'HTTP/1.1 410 Gone';
$errcodes[411] = 'HTTP/1.1 411 Length Required';
$errcodes[412] = 'HTTP/1.1 412 Unless True';
$errcodes[500] = 'HTTP/1.1 500 Internal Server Error';
$errcodes[501] = 'HTTP/1.1 501 Not Implemented';
$errcodes[502] = 'HTTP/1.1 502 Bad Gateway';
$errcodes[503] = 'HTTP/1.1 503 Service Unavailable';
$errcodes[504] = 'HTTP/1.1 504 Gateway Timeout';
?>
This is then used as:
<?php
// Now send the 404 header
header($errcodes[404]);
?>