I'm trying to print raw html with PHP like this:
<?php
$head = htmlspecialchars('<head></head>',ENT_QUOTES);
echo $head;
?>
This works nothing wrong with it if you are willing to print this ammount of html.
The problem is what if i want to print alot of html. Look at the picture below:
It comes out really messy. I want to add some line breaks in between, but if i do this it will just print <br/>
right?
答案 0 :(得分:2)
You can wrap your html output in <pre>
tags to keep the intial formatting.
So your code would change to :
<?php
$head = htmlspecialchars('<head></head>',ENT_QUOTES);
echo "<pre>".$head."</pre>";
?>