Do you have a question? Post it now! No Registration Necessary. Now with pictures!
March 23, 2007, 4:33 pm
rate this thread
I've got a textual file with some words inside:
file = foo.txt
I would like to print this text on a the web.
I tried to use the file function:
$file = "/var/www/backup/foo.txt";
$content = file_get_contents($file);
but I get
foo1 foo2 foo3 foo4 foo5 foo6
how can I get the output as the original file?
Re: problem with file
That IS the original file. Really. :-)
Browsers do not display the newline character \n.
They ignore it.
If you need a newline in HTML use <br>.
So you have to replace your newlines with <br> before echoing it.