note 52576 added to function.fopen

From: Date: Fri, 06 May 2005 08:58:18 +0000
Subject: note 52576 added to function.fopen
Groups: php.notes 
Request: Send a blank email to php-notes+get-88991@lists.php.net to get a copy of this message
'fopen' only opens a handle to the file. You may want to use it in this format; <?php $hi = fopen("myfile.txt","r"); $text = fread($hi,filesize("myfile.txt")); fclose($hi); ?> So '$text' would = contents of file, or use this alternative function; <?php $hi = file("myfile.txt"); print_r($hi); ?> 'file' reads the contents of your file, and will store it in the '$hi' variable as an array of lines. 'print_r' will simply print this array in an easy-to-read way. ---- Manual Page -- http://www.php.net/manual/en/function.fopen.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+52576 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+52576&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+52576&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+52576&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+52576&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+52576&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+52576&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#88991) next »