readfile.php simple read file example php source code $myfile = fopen("file.txt", "r") or die("Unable to open file.txt!"); $data = fread($myfile,filesize("file.txt")); fclose($myfile); echo $data; echo "now a line at a time
\n"; $myfile = fopen("file.txt", "r") or die("Unable to open file.txt!"); while(!feof($myfile)) { echo fgets($myfile); } fclose($myfile);
Warning: fopen(file.txt): failed to open stream: No such file or directory in /afs/umbc.edu/users/s/q/squire/pub/www/readfile.php on line 21
Unable to open file.txt!