zimbabweo Posted March 11, 2013 Share Posted March 11, 2013 I can't figure out how to combine readfile() with <pre> tags so that the \n linebreaks in my text file are displayed properly. // works but doesn't print line breaksecho readfile("filename.txt"); // doesn't work -- parse error echo "<pre>readfile("filename.txt")</pre>"; // doesn't work -- parse errorecho "<pre>{readfile("filename.txt")}</pre>\n"; Any tips to solve this? Link to comment https://forums.phpfreaks.com/topic/275478-tags-with-readfile/ Share on other sites More sharing options...
Barand Posted March 11, 2013 Share Posted March 11, 2013 echo '<pre>'; readfile('filename.txt'); echo '</pre>'; or echo nl2br(file_get_contents('filename.txt')); Link to comment https://forums.phpfreaks.com/topic/275478-tags-with-readfile/#findComment-1417882 Share on other sites More sharing options...
zimbabweo Posted March 11, 2013 Author Share Posted March 11, 2013 Barand, that works perfectly!! Many thanks. Link to comment https://forums.phpfreaks.com/topic/275478-tags-with-readfile/#findComment-1417883 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.