D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
www
/
html
/
novonote
/
adm
/
Filename :
testezip.php
back
Copy
<?php $zip = new ZipArchive(); $zipPath = __DIR__ . '/teste.zip'; if ($zip->open($zipPath, ZipArchive::CREATE | ZipArchive::OVERWRITE)) { $zip->addFromString('exemplo.txt', 'Conteúdo de teste'); $zip->close(); } if (file_exists($zipPath)) { if (ob_get_level()) ob_end_clean(); header('Content-Type: application/zip'); header('Content-Disposition: attachment; filename="teste.zip"'); header('Content-Length: ' . filesize($zipPath)); header('Pragma: public'); header('Cache-Control: must-revalidate'); header('Expires: 0'); readfile($zipPath); unlink($zipPath); exit; } else { echo "ZIP não encontrado."; }