Entry
When i include a txt file the html page ignores the end of lines. And i get one long line with text. I would have multiple lines with hard breaks.
Why is fread adding in the escape codes to a txt file that I am echo'ing
In the following script, how do I get hard line breaks? $GrabURL = "http://www.geocities.com/michael
Apr 2nd, 2008 20:52
dman, ha mo, Alder Rus, Philip Olson, Todor Gaidarov, Rini Setiadarma, kees brown, Jeremy Fulton, Walt Disney, http://www.ttnr.org
Try this :
$file = 'info.txt';
$fp = fopen($file,'r');
$info = fread($fp, filesize($file));
$info is now the contents (a string) of the file info.txt. To convert
linebreaks (\n) to <br>'s in a string, let's use the PHP nl2br()
function :
$info = nl2br($info):
Now each linebreaks will be <br>'s.
http://www.php.net/manual/en/function.nl2br.php
Also note that such linebreaks show up in browser in <pre></pre>,
perhaps this faqt will be of use too :
http://www.faqts.com/knowledge_base/view.phtml/aid/901/fid/40