note 62005 added to function.flock

From: Date: Fri, 17 Feb 2006 06:03:41 +0000
Subject: note 62005 added to function.flock
Groups: php.notes 
Request: Send a blank email to php-notes+get-103881@lists.php.net to get a copy of this message
Also note that if you want to truncate a file, but make sure it's locked first, you DON'T need to use a separate lock file like the directions say. Use this instead: <?php $f=fopen("file", "r+"); flock($f, LOCK_EX) or die("Error! cant lock!"); ftruncate($f, 0); fwrite($f, $stuff); fclose($f); ?> But if you open a file with "w" or "w+" you WILL blow it away before you can lock it. ---- Server IP: 210.138.109.182 Probable Submitter: 61.195.156.129 ---- Manual Page -- http://www.php.net/manual/en/function.flock.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+62005 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+62005&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+62005&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+62005&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+62005&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+62005&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+62005&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+62005&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+62005&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#103881) next »