加入收藏 | 设为首页 | 会员中心 | 我要投稿 北几岛 (https://www.beijidao.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

使用php在浏览器中显示.msg文件

发布时间:2021-07-06 05:22:41 所属栏目:大数据 来源: https://www.jb51.cc
导读:我在PHP应用程序中附加了outlook msg文件.我将该文件存储在sql server数据库中. 现在我想打开并从浏览器中显示它. 我试过这段代码: if($ext=="msg") { header('ContentType : application/octet-stream'); header('Content-Disposition: attachment; filena

我在PHP应用程序中附加了outlook msg文件.我将该文件存储在sql server数据库中.

现在我想打开并从浏览器中显示它.

我试过这段代码:

  if($ext=="msg")
  {
    header('ContentType : application/octet-stream');
    header('Content-Disposition: attachment; filename='. basename($filename));
    echo base64_decode($file);
  }

$filename和$file来自数据库.

从IE和Chrome开放的Outlook开放的msg文件,但它没有从firefox开放.

有没有办法让它在所有浏览器中工作?

或者我错了某处或浏览器中有任何设置?

解决方法:

我有一个几乎相似的情况,并能够解决它.
包括下面的标题,它应该工作得很好.

问候

header("Pragma: public");
header("Expires: 0");
header('Content-Encoding: UTF-8');
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-type: application/vnd.ms-outlook;charset=UTF-8"); 
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");;
header("Content-Disposition: attachment;filename=test.msg");
header("Content-Transfer-Encoding: binary ");

(编辑:北几岛)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读