如何使用<pre>标签不出现在源代码中
How to use <pre> tag to don't appear in the source code
我想像 pastebin.com 那样在原始视图模式下呈现网页。
这是 pastebin.com
上的示例
http://pastebin.com/raw.php?i=VawEm8ge
如果您查看源代码,则没有 html 代码。
我这样试过:
<pre style="word-wrap: break-word; white-space: pre-wrap;">
#EXTM3U
#EXTVLCOPT:udp-caching=1000
#EXTINF:-1, DUNA Televízió
http://212.40.98.166/intstreams/mtva/dunalive.smil/VID_854x480_HUN.m3u8
#EXTINF:-1 , Duna World
http://212.40.98.161/intstreams/mtva/dunaworldlive_international.smil/VID_854x480_HUN.m3u8
</pre>
但是输出与pastebin.com
的输出不一样
因为那个页面不是HTML。如果您查看响应,Content-Type
是 text/plain; charset=utf-8
。
要在你的服务器上做同样的事情,你需要控制响应头来设置Content-Type
。例如:
header('Content-Type: text/plain');
写输出前设置即可
我想像 pastebin.com 那样在原始视图模式下呈现网页。 这是 pastebin.com
上的示例http://pastebin.com/raw.php?i=VawEm8ge
如果您查看源代码,则没有 html 代码。
我这样试过:
<pre style="word-wrap: break-word; white-space: pre-wrap;">
#EXTM3U
#EXTVLCOPT:udp-caching=1000
#EXTINF:-1, DUNA Televízió
http://212.40.98.166/intstreams/mtva/dunalive.smil/VID_854x480_HUN.m3u8
#EXTINF:-1 , Duna World
http://212.40.98.161/intstreams/mtva/dunaworldlive_international.smil/VID_854x480_HUN.m3u8
</pre>
但是输出与pastebin.com
的输出不一样因为那个页面不是HTML。如果您查看响应,Content-Type
是 text/plain; charset=utf-8
。
要在你的服务器上做同样的事情,你需要控制响应头来设置Content-Type
。例如:
header('Content-Type: text/plain');
写输出前设置即可