note 59392 added to function.header

From: Date: Mon, 05 Dec 2005 19:42:54 +0000
Subject: note 59392 added to function.header
Groups: php.notes 
Request: Send a blank email to php-notes+get-99603@lists.php.net to get a copy of this message
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]); ?> ---- Manual Page -- http://www.php.net/manual/en/function.header.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+59392 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+59392&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+59392&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+59392&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+59392&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+59392&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+59392&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+59392&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+59392&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#99603) next »