Re: writing data to a file, pointers

From: Date: Fri, 15 Mar 2002 09:33:54 +0000
Subject: Re: writing data to a file, pointers
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-88634@lists.php.net to get a copy of this message
On Fri, 15 Mar 2002, Philip J. Newman wrote: > can someone point me in the right direction for writing data to a file. > > d:/site/file.txt > > infomation: > > [DATE] Information $information = 'Some information'; $filename = 'd:/site/file.txt'; if ((is_writable($filename) || !file_exists($filename)) && $fp = @fopen($filename, 'a')) { fputs($fp, date('[d-M-Y] ') . $information . "\n"); fclose($fp); } else { print "Unable to open {$filename} for output"; } Look up fopen, fputs, fclose in the manual for more details on what's going on here. miguel

« previous php.general (#88634) next »