note 92942 added to function.ob-get-flush

From: Date: Sat, 15 Aug 2009 19:06:57 +0000
Subject: note 92942 added to function.ob-get-flush
Groups: php.notes 
Request: Send a blank email to php-notes+get-159526@lists.php.net to get a copy of this message
"I don't know how exactly this works, but if you call this function, PHP would behave as if headers have been sent (even though the output has gone to a string)." This function actually returns the buffer AND sends it to the browser (thogether with all headers), cleaning it afterwards. If you want to send headers / use setcookie() after getting contents of the buffer, use ob_get_clean() instead. This code actually works: <?php ob_start(); echo 'http://www.example.com/'; $buf = ob_get_clean(); header('Location: ' . $buf); ?> ---- Server IP: 64.71.164.2 Probable Submitter: 83.21.143.93 ---- Manual Page -- http://www.php.net/manual/en/function.ob-get-flush.php Edit -- https://master.php.net/note/edit/92942 Del: integrated -- https://master.php.net/note/delete/92942/integrated Del: useless -- https://master.php.net/note/delete/92942/useless Del: bad code -- https://master.php.net/note/delete/92942/bad+code Del: spam -- https://master.php.net/note/delete/92942/spam Del: non-english -- https://master.php.net/note/delete/92942/non-english Del: in docs -- https://master.php.net/note/delete/92942/in+docs Del: other reasons-- https://master.php.net/note/delete/92942 Reject -- https://master.php.net/note/reject/92942 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#159526) next »