简体   繁体   English

php提取文件内容并以格式打印出来

[英]php fetch file content and print it out formatted

How can i print out an formatted HTML file ? 如何打印格式化的HTML文件? 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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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