note 117465 added to ref.outcontrol
| From: | AttilaHoutkooper | Date: | Sat, 13 Jun 2015 19:10:46 +0000 |
| Subject: | note 117465 added to ref.outcontrol | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-202855@lists.php.net to get a copy of this message | ||
Take care to take exceptions in the code in mind when using ob_start and ob_get_contents. If you do
not do this, the number of calls to ob_start will not match those to ob_end and you're not
gonna have a good time.
<?php
public function requireIntoVariable($path) {
ob_start();
try {
require $path;
} catch (Exception $e) {
ob_end_clean();
throw $e;
}
$output = ob_get_contents();
ob_end_clean();
return $output;
}
?>
----
Server IP: 72.52.91.14
Probable Submitter: 2001:980:b01f:1:7869:4259:786b:5222
----
Manual Page -- http://php.net/manual/en/ref.outcontrol.php
Edit -- https://master.php.net/note/edit/117465
Del: integrated -- https://master.php.net/note/delete/117465/integrated
Del: useless -- https://master.php.net/note/delete/117465/useless
Del: bad code -- https://master.php.net/note/delete/117465/bad+code
Del: spam -- https://master.php.net/note/delete/117465/spam
Del: non-english -- https://master.php.net/note/delete/117465/non-english
Del: in docs -- https://master.php.net/note/delete/117465/in+docs
Del: other reasons-- https://master.php.net/note/delete/117465
Reject -- https://master.php.net/note/reject/117465
Search -- https://master.php.net/manage/user-notes.php