borris83
03-30-2009, 03:59 PM
Hi I am trying to write to a file using fwrite()...
Can I use a variable inside fwrite? If yes then how to do that?
I have tried to use two variables $surl and $lurl but they don't work... Instead of creating a file with the name as the value of the variable, it actually creates a file $surl.php
$fp = fopen('$surl.php','w' );
fwrite($fp, '<?php header("Location: $lurl"); exit; ?>');
fclose($fp);
Can I use a variable inside fwrite? If yes then how to do that?
I have tried to use two variables $surl and $lurl but they don't work... Instead of creating a file with the name as the value of the variable, it actually creates a file $surl.php
$fp = fopen('$surl.php','w' );
fwrite($fp, '<?php header("Location: $lurl"); exit; ?>');
fclose($fp);