Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将纯文本转换为html,但保持显示格式?_Html - Fatal编程技术网

如何将纯文本转换为html,但保持显示格式?

如何将纯文本转换为html,但保持显示格式?,html,Html,我有一个纯文本是程序输出,但我想在html页面中显示它。但我仍然想保留格式(如空格/tab/enter等),这就像stackoverflow的代码块一样,如何在html中正确显示它?谢谢程序程序使用“pre”和“code”HTML标记: <pre><code> code in here... </code></pre> 使用“pre”和“code”HTML标记: 谢谢,刚刚发现符合我的要求谢谢,刚刚发现符合我的要求

我有一个纯文本是程序输出,但我想在html页面中显示它。但我仍然想保留格式(如空格/tab/enter等),这就像stackoverflow的代码块一样,如何在html中正确显示它?谢谢

程序
程序
使用“pre”和“code”HTML标记:

<pre><code>   code in here...  </code></pre>
使用“pre”和“code”HTML标记:

谢谢,刚刚发现
符合我的要求谢谢,刚刚发现
符合我的要求