Output buffering - saving + echoing

From: Date: Wed, 15 Dec 2004 02:01:39 +0000
Subject: Output buffering - saving + echoing
Groups: php.general 
Request: Send a blank email to php-general+get-204384@lists.php.net to get a copy of this message
Hi, When using ob_start(), the output is buffered and not sent till ob_end_flush() is called or got to end of the script. Also before flushing you can get the buffer contents by ob_get_contents(). <? //start buffering, from now on no output. //NEED: start buffering, but output imediatly when echo. ob_start(); //this is not echoed now. //NEED: echo this now, but still buffer it too. echo "Hello, World!"; //getting the buffer contents. //NEED: getting the buffer contents. $buf=ob_get_contents(); //the buffer is echoed just now. //NEED: stop the buffering, and not output all the buffer now. ob_end_flush(); ?> What I want to do is "catch" the output buffer, but do not delay the buffer to be sent. How is it done? thanks in advance, Lorderon.

« previous php.general (#204384) next »