Reputation: 476
I want to print exact text files of a file. But, as the file contains HTML code (example:
<br/>
,
<table>
etc.) the formatting of the page changes. I want to echo exactly what the file contains,
<br/>
,
<table>
etc. printed in the page. How can I do that?
Please help.
Upvotes: 1
Views: 152
Reputation: 5488
If you want your whole page that way, then you can set the header to
header('Content-Type:text/plain');
and then echo our file contents.
Upvotes: 1
Reputation: 68546
Make use of htmlentities()
[Pretty heavy when compared to htmlspecialchars()
]
<?php
echo htmlentities($yourhtmlcontent);
Alternatively, you could make use of htmlspecialchars()
too.
Upvotes: 1