note 93682 deleted from function.header by danbrown

From: Date: Wed, 28 Oct 2009 16:06:55 +0000
Subject: note 93682 deleted from function.header by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-162191@lists.php.net to get a copy of this message
Note Submitter: guy.paddock AT gmail DOT com ---- The use of the $http_response_code parameter is a little unclear in the docs, especially because the only example of how to send an HTTP status code header doesn't even use the parameter. The point of the parameter is to have PHP automatically translate an HTTP status code to its corresponding phrase (404 because "404 Not Found"), just as "fgif2 at yahoo dot fr" mentioned. In my case, an application I'm developing puts appropriate HTTP status codes in for the "code" parameter of any thrown exceptions, to allow pages to translate the exceptions into HTTP errors when issues are encountered. The example "fgif2 at yahoo dot fr" provides is counter-intuitive, because he passes "NULL" for the $replace boolean parameter and "TRUE" for the $string string parameter. Here's a more straightforward example for sending a 500 response: <?php header('HTTP', true, 500); ?>

« previous php.notes (#162191) next »