note 51278 added to function.fwrite

From: Date: Fri, 25 Mar 2005 14:24:18 +0000
Subject: note 51278 added to function.fwrite
Groups: php.notes 
Request: Send a blank email to php-notes+get-86981@lists.php.net to get a copy of this message
Using fwrite to write to a file in your include folder... PHP does not recognise the permissions setting for the file until you restart the server... this script works fine. (still have to create the blank text file first though...it is not created automatically) On OS X Server.. Using the 1 in fopen tells php to look for the file in your include folder. Change your include folder by altering include_path in php.ini On OS X Server, php.ini is in private/etc/php.ini.default copy the file and call it php.ini the default include path is usr/lib/php (All these folders are hidden - use TinkerTool to reveal them) <?php $file = fopen('textfile.txt', 'a', 1); $text="\n Your text to write \n ".date('d')."-".date('m')."-".date('Y')."\n\n"; fwrite($file, $text); fclose($file); ?> ---- Manual Page -- http://www.php.net/manual/en/function.fwrite.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+51278 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51278&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51278&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51278&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51278&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51278&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+51278&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#86981) next »