link7722 Posted October 15, 2012 Share Posted October 15, 2012 Hello I want to display the contents of a file in html like this: <?php $file = file.txt; echo '<code><pre>' . $file . '</pre></code>' ; ?> The problem is that because the file contains sentences which have "<" and ">" characters, for example "Bla bla <6545465465> bla bla " the content <6545465465> is not displayed on the page. Is there a way to display what is inside these speccial characters ? Thank you Quote Link to comment https://forums.phpfreaks.com/topic/269474-display/ Share on other sites More sharing options...
gizmola Posted October 15, 2012 Share Posted October 15, 2012 Take a look at htmlentities. Quote Link to comment https://forums.phpfreaks.com/topic/269474-display/#findComment-1385252 Share on other sites More sharing options...
link7722 Posted October 15, 2012 Author Share Posted October 15, 2012 Take a look at htmlentities. htmlentities. did the jobThank you Quote Link to comment https://forums.phpfreaks.com/topic/269474-display/#findComment-1385253 Share on other sites More sharing options...
Volter9 Posted November 7, 2012 Share Posted November 7, 2012 (edited) link7722, you can also use htmlspecialchars() Edited November 7, 2012 by Volter9 Quote Link to comment https://forums.phpfreaks.com/topic/269474-display/#findComment-1390695 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.