下载的现有odt文件与PHP中的实际odt文件不匹配

时间:2017-03-08 11:34:51

标签: php

我尝试使用以下PHP代码下载现有的odt文件。

if(ini_get('zlib.output_compression'))
      ini_set('zlib.output_compression', 'Off');

    header('Content-Description: File Transfer');
    header("Pragma: public");   // required
    header("Expires: 0");       // no cache
    header("Cache-Control: must-revalidate");
    header("Cache-Control: private");
    header("Content-Type: application/vnd.oasis.opendocument.text");
    header("Content-Disposition: inline; filename=\"".basename($filename)."\";");

    header("Content-Transfer-Encoding: binary");
    header("Content-Length: ".filesize($filename));
    readfile("$filename");
    exit(); 

执行时,会下载odt文件,但内容不是原始的odt文件内容。下载的文件包含具有多个页面的序列化或不可读文本。有人可以帮我把实际文件下载吗?

0 个答案:

没有答案