Jump to content

[PHP5] File reading problems


Drezard

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.