note 116880 added to function.http-response-code

From: Date: Sun, 15 Mar 2015 01:12:20 +0000
Subject: note 116880 added to function.http-response-code
Groups: php.notes 
Request: Send a blank email to php-notes+get-201943@lists.php.net to get a copy of this message
http_response_code is basically a shorthand way of writing a http status header, with the added bonus that PHP will work out a suitable Reason Phrase to provide by matching your response code to one of the values in an enumeration it maintains within php-src/main/http_status_codes.h. Note that this means your response code must match a response code that PHP knows about. You can't create your own response codes using this method, however you can using the header method. In summary - The differences between "http_response_code" and "header" for setting response codes: 1. Using http_response_code will cause PHP to match and apply a Reason Phrase from a list of Reason Phrases that are hard-coded into the PHP source code. 2. Because of point 1 above, if you use http_response_code you must set a code that PHP knows about. You can't set your own custom code, however you can set a custom code (and Reason Phrase) if you use the header method. ---- Server IP: 72.52.91.14 Probable Submitter: 123.2.21.93 ---- Manual Page -- http://php.net/manual/en/function.http-response-code.php Edit -- https://master.php.net/note/edit/116880 Del: integrated -- https://master.php.net/note/delete/116880/integrated Del: useless -- https://master.php.net/note/delete/116880/useless Del: bad code -- https://master.php.net/note/delete/116880/bad+code Del: spam -- https://master.php.net/note/delete/116880/spam Del: non-english -- https://master.php.net/note/delete/116880/non-english Del: in docs -- https://master.php.net/note/delete/116880/in+docs Del: other reasons-- https://master.php.net/note/delete/116880 Reject -- https://master.php.net/note/reject/116880 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#201943) next »