note 50094 added to function.fwrite

From: Date: Thu, 17 Feb 2005 20:15:39 +0000
Subject: note 50094 added to function.fwrite
Groups: php.notes 
Request: Send a blank email to php-notes+get-85180@lists.php.net to get a copy of this message
difficulty appending to file in SAFE MODE ON if you are getting resource errors etc try this... $textline="whatever string you submitted or created"; $filename="afilename.log"; // or whatever your path and filename if (!$handle = fopen($filename, 'a')) { echo "Cannot open file ($filename)"; // or handle your error exit; } $textline.="\n"; // dont forget that period // now write content to our opened file. IF (fwrite($handle,$textline) === FALSE) {echo "Cannot write to file ($filename)";// or handle your error exit;} echo "Success, wrote ($textline) to file ($filename)"; fclose($handle); ---- Manual Page -- http://www.php.net/manual/en/function.fwrite.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+50094 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+50094&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+50094&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+50094&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+50094&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+50094&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+50094&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#85180) next »