Hi,
How can I read multiple lines from a text file?
When I use: include("shows.txt");
It takes out all formatting.
And when I use: $file_contents = file("shows.txt"); echo $file_contents;
I just get 'Array' displayed.
Help?
file() returns an array. By formatting, are you referring to new lines? Keeping in mind that file() returns an array; just loop through the array and output. use nl2br() to convert new lines to html breaks.
Cgraz
and to read the contents of a file, and echo them to the browser, do this:
<? $size = filesize("file.txt"); $fp = fopen("file.txt", "r"); flock($fp, LOCK_EX); $content = fread($fp, $size); flock($fp, LOCK_UN); fclose($fp); ?>