Entry
How can I replace the contents of a file?
Jul 10th, 1999 09:37
Nathan Wallace, Alexander Avilov, Brad Marsh
Check the mode parameter for
http://www.php.net/manual/function.fopen.php3
'w' - Open for writing only; place the file pointer at the beginning
of the file and truncate the file to zero length. If the file does
not exist, attempt to create it.
Here is an example:
@$fp = fopen ("$notify", "w");
fwrite ($fp, $email_file) or die("Couldn't write e-mail file!");
@fclose ($fp);
This was a script to write a file to be emailed. Every time it was
called the $email_file variable was written to $notify (a path/file name
combo).