Menu
I’m trying to use php’s output buffering functions. But I haven’t really succeeded yet. I have a txt-file with the contents:
test.txt:
<font color=”#FF0000″><b>$var</b></font>
I’m trying to capture what’s in here then assign a value to $var and print it. This is my code so far.
test.php:
<?php
$var = “It works!”;
ob_start ();
include (‘test.txt’);
$test = ob_get_contents ();
ob_clean ();
ob_end_flush ();
echo “$test”;
?>
It prints out (viewing source code):
<font color=”#FF0000″><b>$var</b></font>
So the variable $var hasn’t gotten his value.
Thanks in advance.