note 40593 added to function.file-get-contents

From: Date: Tue, 09 Mar 2004 07:07:18 +0000
Subject: note 40593 added to function.file-get-contents
Groups: php.notes 
Request: Send a blank email to php-notes+get-66469@lists.php.net to get a copy of this message
Under some circumstances only an empty string was returned by the function replacement file_get_contents of ragnarokonline dot de. Here's a fix: if (!function_exists('file_get_contents')) { function file_get_contents($filename, $use_include_path = 0) { $file = @fopen($filename, 'rb', $use_include_path); if ($file) { if ($filesize = @filesize($filename)) { $filecontent = fread($file, $filesize); } else { $filecontent = ''; while (!feof($file)) { $filecontent .= fread($file, 1024); } } fclose($file); } return $filecontent; } } ---- Manual Page -- http://www.php.net/manual/en/function.file-get-contents.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+40593 Delete -- http://master.php.net/manage/user-notes.php?action=delete+40593&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+40593&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#66469) next »