frist44 Posted February 19, 2009 Share Posted February 19, 2009 I'm importing a syslog file into a page and just want to display the contents. I'm having trouble getting the line breaks to show breaks on the page. This is what I have so far. <?php $filename = "file.log"; $fd = fopen ($filename, "r"); $contents = fread ($fd,filesize ($filename)); fclose ($fd); echo $contents; ?> What else do i need to add? Link to comment https://forums.phpfreaks.com/topic/145994-separate-lines-of-log/ Share on other sites More sharing options...
sasa Posted February 19, 2009 Share Posted February 19, 2009 look nl2br() function Link to comment https://forums.phpfreaks.com/topic/145994-separate-lines-of-log/#findComment-766454 Share on other sites More sharing options...
frist44 Posted February 19, 2009 Author Share Posted February 19, 2009 I got it. $separatedcontents = str_replace("\n", "</br>", $contents); Link to comment https://forums.phpfreaks.com/topic/145994-separate-lines-of-log/#findComment-766455 Share on other sites More sharing options...
frist44 Posted February 19, 2009 Author Share Posted February 19, 2009 look nl2br() function Nice. That works too! Link to comment https://forums.phpfreaks.com/topic/145994-separate-lines-of-log/#findComment-766456 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.