note 92942 deleted from function.ob-get-flush by danbrown
| From: | danbrown@php.net | Date: | Sat, 15 Aug 2009 19:17:26 +0000 |
| Subject: | note 92942 deleted from function.ob-get-flush by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-159527@lists.php.net to get a copy of this message | ||
Note Submitter: KORDiAN
----
"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);
?>