note 101998 added to function.fread

From: Date: Sat, 22 Jan 2011 02:59:51 +0000
Subject: note 101998 added to function.fread
Groups: php.notes 
Request: Send a blank email to php-notes+get-175993@lists.php.net to get a copy of this message
if you recently appended something to file, and closed it then this method will not show appended data: <?php // get contents of a file into a string $filename = "/usr/local/something.txt"; $handle = fopen($filename, "r"); $contents = fread($handle, filesize($filename)); fclose($handle); ?> You should insert a call to clearstatcache() before calling filesize() I've spent two hours to find that =/ ---- Server IP: 69.147.83.197 Probable Submitter: 217.30.247.13 (proxied: 127.0.0.1) ---- Manual Page -- http://www.php.net/manual/en/function.fread.php Edit -- https://master.php.net/note/edit/101998 Del: integrated -- https://master.php.net/note/delete/101998/integrated Del: useless -- https://master.php.net/note/delete/101998/useless Del: bad code -- https://master.php.net/note/delete/101998/bad+code Del: spam -- https://master.php.net/note/delete/101998/spam Del: non-english -- https://master.php.net/note/delete/101998/non-english Del: in docs -- https://master.php.net/note/delete/101998/in+docs Del: other reasons-- https://master.php.net/note/delete/101998 Reject -- https://master.php.net/note/reject/101998 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#175993) next »