jkies00 Posted September 5, 2006 Share Posted September 5, 2006 Hello,I've opened a directory, and I'm trying to read a text file, but I can't get it to read:[code]$subFolders = opendir($dir); $myfile = "info.txt";$fh = fopen($myFile, 'r');$theData = fread($fh, 5);fclose($fh);echo $theData;[/code]The directory I've opened does contain the info.txt file I'm looking for. I'm able to view it if I list the contents of the folder. Why can't I read it? The above code returns no output.~jeff Quote Link to comment Share on other sites More sharing options...
Caesar Posted September 5, 2006 Share Posted September 5, 2006 Try:[code]<?php $myfile = file('info.txt'); print_r($myfile);?>[/code]See if you can get he contents of the array to output. Quote Link to comment Share on other sites More sharing options...
jkies00 Posted September 6, 2006 Author Share Posted September 6, 2006 Still nothing. Would it matter that my $dir variable is coming from an array?[code]$dir = $dirArray[0];$subFolders = opendir($dir); $myfile = file('info.txt');print_r($myfile);[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.