我.gz压缩文件二进制64解码代码,我想解压缩它并将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;
我找到了解决方案。
$g=tempnam('/tmp','ff');
@file_put_contents($g,$base64binary);
ob_start();
readgzfile($g);
$d=ob_get_clean();
return $d;