Connecting Tech Pros Worldwide Help | Site Map

fwrite

Ken
Guest
 
Posts: n/a
#1: Jul 17 '05
I have a template.php file in which the results is created with session
variables.

I want to write the actual data, not session variables, into a file called
test.tmp

I can view the actual data when template.php is displayed.

When I write the data to test.tmp, the session variables are copied, not the
results of the variables.

How do I write (save) the results of the template.php in test.tmp?

$url_read = $_SESSION['folder_dir']."template.php";
$url_write = $_SESSION['folder_dir'].'test.tmp';
$f_r = file($url_read);
$read_file = fopen($url_read, "r");
echo $read_file;

$f_w = file($url_write);
$write_file = fopen($url_write, "w");
foreach($f_r as $line) {
fwrite($f_w,$line);
}
fclose($read_file);
fclose($write_file);

Thanks.

Ken



Closed Thread