1

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.

0

2 Answers 2

1

Make use of htmlentities() [Pretty heavy when compared to htmlspecialchars()]

<?php
echo htmlentities($yourhtmlcontent);

Alternatively, you could make use of htmlspecialchars() too.

Sign up to request clarification or add additional context in comments.

Comments

1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.