note 97026 deleted from function.header by tularis
| From: | tularis@php.net | Date: | Fri, 04 Apr 2014 11:24:39 +0000 |
| Subject: | note 97026 deleted from function.header by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-199143@lists.php.net to get a copy of this message | ||
Note Submitter: xxxbunker dot com
----
there are times when one would want to output a html status 500 'mid response'.
i wasn't able to get a clear answer weather sending a (be it incomplete) body with a 500 is
proper, but what i found works nicely (assuming you are using output buffering, and haven't
flushed the buffer before requiring a 500):
a) ..... some of the document body is buffered .....
b) ..... something happens that merits a html status 500 .....
c) ob_end_clean() - this will basically purge whatever document body is in the buffer 'to this
point'
d) use header('.... to display the html status 500.
e) die();
what you are left with, is a html status 500, with no body.
nice and clean, just the way we like it :)