note 72499 added to ref.outcontrol
| From: | basicartsstudios at hotmail dot com | Date: | Sun, 21 Jan 2007 18:39:46 +0000 |
| Subject: | note 72499 added to ref.outcontrol | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-122006@lists.php.net to get a copy of this message | ||
Sometimes you might not want to include a php-file under the specifications defined in the functions
include() or require(), but you might want to have in return the string that the script in the file
"echoes".
Include() and require() both directly put out the evaluated code.
For avoiding this, try output-buffering:
<?php
ob_start();
eval(file_get_contents($file));
$result = ob_get_contents();
ob_end_clean();
?>
or
<?php
ob_start();
include($file);
$result = ob_get_contents();
ob_end_clean();
?>
which i consider the same, correct me if I'm wrong.
Best regards, BasicArtsStudios
----
Server IP: 194.153.94.10
Probable Submitter: 84.75.248.50
----
Manual Page -- http://www.php.net/manual/en/ref.outcontrol.php
Edit -- https://master.php.net/note/edit/72499
Del: integrated -- https://master.php.net/note/delete/72499/integrated
Del: useless -- https://master.php.net/note/delete/72499/useless
Del: bad code -- https://master.php.net/note/delete/72499/bad+code
Del: spam -- https://master.php.net/note/delete/72499/spam
Del: non-english -- https://master.php.net/note/delete/72499/non-english
Del: in docs -- https://master.php.net/note/delete/72499/in+docs
Del: other reasons-- https://master.php.net/note/delete/72499
Reject -- https://master.php.net/note/reject/72499
Search -- https://master.php.net/manage/user-notes.php