| 1 | $tmp_file = tmpfile(); |
| 2 | $tmp_file_path = stream_get_meta_data($tmp_file)['uri']; |
| 3 | |
| 4 | $zip = new ZipArchive; |
| 5 | $res = $zip->open($tmp_file_path, ZipArchive::CREATE); |
| 6 | |
| 7 | foreach ($ptah_p7s->Signs as $i => $sign) { |
| 8 | $zip->addFromString("signature{$i}.p7s", base64_decode($sign)); |
| 9 | } |
| 10 | |
| 11 | $zip->close(); |
| 12 | |
| 13 | header('Content-type: application/zip'); |
| 14 | header('Content-Disposition: attachment; filename="download.zip"'); |
| 15 | echo(file_get_contents($tmp_file_path)); |
stuzer05 / PHP create in-memory zip archive
Last active 3 months ago
Revision f9de9c2c8f69f6a8c1fad122f10a41d7137b2ece