include () in variable redirect
June 23, 2009, Posted by admin at 6:00 am
Sometimes you have the contents of a file into a variable store, just before the file will be executed, eg because they contain PHP code is executed before it.
If the file is only read by fread, would the PHP code is not executed.
But there is an elegant method that is compatible with the so-called output buffering to fix.
They simply create a new PHP file in the following states:
<? php
ob_start (); / / start buffer
include ( “datei.php”); / / datei.php is now in the buffer
$ var = ob_get_contents (), / / buffer is written in $ var
ob_end_clean (); / / buffer is cleared
echo $ var; / / $ var is still used
?>
Sun is now in the $ var is already exported content from datei.php.

You must be logged in to post a comment.