dongxixian7803 2015-09-29 00:37
浏览 173
已采纳

如何使用<pre>标签不出现在源代码中[关闭]

I would like to render a webpage like the pastebin.com does in a raw view mode. Here is an example on pastebin.com

http://pastebin.com/raw.php?i=VawEm8ge

if you look to the source code, there is no html code.

I tried in this way:

   <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>

But the output is not the same with the output from the pastebin.com

  • 写回答

1条回答 默认 最新

  • douchuifk90315 2015-09-29 00:40
    关注

    It is because that page is not HTML. If you take a look at the response, the Content-Type is text/plain; charset=utf-8.

    To do the same thing on your sever, you need to control the response header to set Content-Type. For example:

    header('Content-Type: text/plain');
    

    Just set it before writing output.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题
  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题