Drezard Posted March 4, 2008 Share Posted March 4, 2008 I'm trying to open and read contents out of a file. Here is my code: <?php error_reporting ('E_ALL'); $path = 'list.txt'; $filestream = fopen($path, 'r') or die('die'); $contents = fread($filestream, 20) or die('dead'); echo $contents; ?> The only output of this page is 'Dead'. list.txt: myfilerandomcontents Whats wrong? Thanks, Daniel Link to comment https://forums.phpfreaks.com/topic/94386-php5-file-reading-problems/ Share on other sites More sharing options...
KrisNz Posted March 4, 2008 Share Posted March 4, 2008 Just use file_get_contents() instead. Link to comment https://forums.phpfreaks.com/topic/94386-php5-file-reading-problems/#findComment-483377 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.