note 97026 added to function.header

From: Date: Mon, 29 Mar 2010 06:32:54 +0000
Subject: note 97026 added to function.header
Groups: php.notes 
Request: Send a blank email to php-notes+get-167480@lists.php.net to get a copy of this message
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 :) ---- Server IP: 64.71.164.2 Probable Submitter: 72.11.143.208 ---- Manual Page -- http://www.php.net/manual/en/function.header.php Edit -- https://master.php.net/note/edit/97026 Del: integrated -- https://master.php.net/note/delete/97026/integrated Del: useless -- https://master.php.net/note/delete/97026/useless Del: bad code -- https://master.php.net/note/delete/97026/bad+code Del: spam -- https://master.php.net/note/delete/97026/spam Del: non-english -- https://master.php.net/note/delete/97026/non-english Del: in docs -- https://master.php.net/note/delete/97026/in+docs Del: other reasons-- https://master.php.net/note/delete/97026 Reject -- https://master.php.net/note/reject/97026 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#167480) next »