简体   繁体   中英

php fetch file content and print it out formatted

How can i print out an formatted HTML file ? This is my current code:

echo htmlspecialchars(file_get_contents($url)); 

But the result looks so ugly, all sticks together, no space no tabs. Is there any way to print the file exactly like the original file ?

The pre-tag would work.

<pre>
<?php echo htmlspecialchars(file_get_contents($url)); ?>
</pre>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM