note 114996 added to function.http-response-code
| From: | StefanW | Date: | Sat, 10 May 2014 14:56:02 +0000 |
| Subject: | note 114996 added to function.http-response-code | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-199504@lists.php.net to get a copy of this message | ||
Note that you can NOT set arbitrary response codes with this function, only those that are known to
PHP (or the SAPI PHP is running on).
The following codes currently work as expected (with PHP running as Apache module):
200 â 208, 226
300 â 305, 307, 308
400 â 417, 422 â 424, 426, 428 â 429, 431
500 â 508, 510 â 511
Codes 0, 100, 101, and 102 will be sent as "200 OK".
Everything else will result in "500 Internal Server Error".
If you want to send responses with a freestyle status line, you need to use the
header() function:
<?php header("HTTP/1.0 418 I'm A Teapot"); ?>
----
Server IP: 213.172.110.14
Probable Submitter: 62.178.130.14
----
Manual Page -- http://php.net/manual/en/function.http-response-code.php
Edit -- https://master.php.net/note/edit/114996
Del: integrated -- https://master.php.net/note/delete/114996/integrated
Del: useless -- https://master.php.net/note/delete/114996/useless
Del: bad code -- https://master.php.net/note/delete/114996/bad+code
Del: spam -- https://master.php.net/note/delete/114996/spam
Del: non-english -- https://master.php.net/note/delete/114996/non-english
Del: in docs -- https://master.php.net/note/delete/114996/in+docs
Del: other reasons-- https://master.php.net/note/delete/114996
Reject -- https://master.php.net/note/reject/114996
Search -- https://master.php.net/manage/user-notes.php