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? Quote 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 Quote 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); Quote 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! Quote Link to comment https://forums.phpfreaks.com/topic/145994-separate-lines-of-log/#findComment-766456 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.