我有.gz压缩文件binary64解码的代码,我想解压缩这个并下载压缩文件中的PDF文件。请给我一个想法。
我做了这样的事......
function getShopmateInvoicePDF($documentName,$fileName,$base64binary){
header('Content-Type: application/gzip');
header('Content-Disposition: attachment; filename="'.trim($fileName).'"');
print $base64binary;
}
我尝试了$base64binary = gzuncompress($base64binary)
header('Content-Type: application/pdf');
header('Content-Disposition: attachment; filename="'.trim($documentName).'.pdf"');
print base64binary;
答案 0 :(得分:0)
我找到了解决方法。
$g=tempnam('/tmp','ff');
@file_put_contents($g,$base64binary);
ob_start();
readgzfile($g);
$d=ob_get_clean();
return $d;