相关疑难解决方法(0)

什么是docx,pptx等正确的mime类型?

对于较旧的*.doc文档,这已足够:

header("Content-Type: application/msword");
Run Code Online (Sandbox Code Playgroud)

我应该将哪些mime类型用于新的docx文档?还适用于pptx和xlsx文件?

excel powerpoint ms-word ms-office mime-types

972
推荐指数
6
解决办法
57万
查看次数

使用PHPWord下载DOCX文件时获取损坏的文件

我正在尝试使用“ PHPWord”下载docx文件。

如果我尝试将文件保存到服务器上,则可以正常工作。但是,如果添加标题以下载文件,则文件将以损坏的形式显示。

注意:我正在使用openOffice打开它。

这是我的代码:

 $document->save($doc);
 header('Content-Description: File Transfer');
 header('Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document');
 header("Content-Disposition: attachment; filename=CV.docx");
 header('Content-Transfer-Encoding: binary');
 header('Expires: 0');
 header('Cache-Control: must-revalidate');
 header('Pragma: public');
 header('Content-Length: ' . filesize($doc));
 readfile($doc);
Run Code Online (Sandbox Code Playgroud)

谁能告诉我这个问题可能是什么?

php phpword

2
推荐指数
1
解决办法
2799
查看次数

标签 统计

excel ×1

mime-types ×1

ms-office ×1

ms-word ×1

php ×1

phpword ×1

powerpoint ×1