【问题标题】:php headers not working correctly under firefoxphp 标头在 firefox 下无法正常工作
【发布时间】:2012-06-18 15:00:31
【问题描述】:

我使用的是这个头文件Content-type: application/vnd.ms-word;,但是在firefox下没有用,它正在下载文件但没有扩展名。为什么,这是firefox的一些安全措施吗?

【问题讨论】:

    标签: php


    【解决方案1】:

    Firefox 不会自行将 .doc 添加到下载的文件中,即使 mime 类型表明它是 word doc。它将使用Content-disposition 标头指定的文件名:

    header('Content-type: application/vnd.ms-word');
    header('Content-disposition: attachment; filename="yourfile.doc"');
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-09-16
      • 1970-01-01
      • 1970-01-01
      • 2019-08-07
      • 2013-06-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多