note 20523 deleted from ref.outcontrol by nlopess
| From: | nlopess@php.net | Date: | Mon, 05 Jan 2004 16:02:57 +0000 |
| Subject: | note 20523 deleted from ref.outcontrol by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-62953@lists.php.net to get a copy of this message | ||
Note Submitter: astericss60@hotmail.com
----
You can use the ob_*-functions to replace the PHP variables in a file with its actual content. It is
useful when you have a template file which includes some variables, like "User=$user"
a.s.o. (Probably there is an easier way?):
$sf = fopen($sourcefile, "r");
$df = fopen($destfile, "w");
ob_start();
while( !feof($sf) )
{
$line = fgets($sf, 4096);
$eval = "echo \"".addslashes($line)."\";";
eval($eval);
$line = ob_get_contents();
fputs($df, stripslashes($line));
}
ob_end_clean();
Possibly, it helps someone...