note 47525 added to function.ob-start

From: Date: Fri, 19 Nov 2004 01:20:30 +0000
Subject: note 47525 added to function.ob-start
Groups: php.notes 
Request: Send a blank email to php-notes+get-80732@lists.php.net to get a copy of this message
In regards to the above content about PHP automatically printing out the Output Buffer, there is a nifty function called ob_end_clean() that will assure that this does not happen. Simply do the following: <? ob_start(); include("consumersurvey-new.txt"); $contents = ob_get_contents(); ob_end_clean(); ?> and the file that is included, anything that is echo'd or printed will be inside the $contents variable. If you were to replace the include() line with an echo, the same statement would apply. Hope this helps. ---- Manual Page -- http://www.php.net/manual/en/function.ob-start.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+47525 Delete -- http://master.php.net/manage/user-notes.php?action=delete+47525&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+47525&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+47525&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+47525&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+47525&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+47525&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+47525&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#80732) next »