faqts : Computers : Programming : Languages : PHP

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

60 of 77 people (78%) answered Yes
Recently 7 of 10 people (70%) answered Yes

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

Mar 1st, 2009 08:43
Sarah Turner, healthy man, 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
http://www.healthdothealth.com
http://www.healthxhealth.com
http://www.mesotheliomainmesothelioma.com
http://www.healthfirewall.com
http://www.flathealth.com
http://www.healthbodyguard.com
http://www.healthbyhealth.com
http://www.healthment.com
http://www.mesotheliomadown.com
http://www.mesotheliomaout.com
http://www.pickarticle.com
http://voyagevacances.blogtact.com/
http://rejseferie.blogtact.com/
http://flyvningertilschweiz.blogtact.com/
http://volssuisse.blogtact.com/
http://volsromeitalie.blogtact.com/
http://viajesvacaciones.blogtact.com/
http://reisenchina.blogtact.com/
http://flugeschweiz.blogtact.com/
http://resasemester.blogtact.com/
http://viaggivacanze.blogtact.com/
http://reisenurlaub.blogtact.com/
http://reizenvakanties.blogtact.com/
http://volisvizzera.blogtact.com/
http://gartenpflege.blogtact.com/
http://geschenkideeen.blogtact.com/
http://vluchtenromeitalie.blogtact.com/