CakePHP:Creare un file zip con ZipArchive
$zip = new \ZipArchive(); $file_path = \Lib\FileLib::getTmpFolder( true ) . \Lib\MiscLib::randomID('tmp').'.zip'; if( $zip->open( $file_path, \ZipArchive::CREATE ) !== TRUE ) exit("cannot open <$file_path>\n"); $report_title = 'export.zip'; foreach( $collezione as $filepath ) { $zip->addFile( $filepath, $filename.'.pdf' ); } $zip->close();