$filePath
為被壓縮的文 件,$dest
為目的壓縮包
function zipFile($filePath,$dest)
{
try{
$zip = new ZipArchive();
$zip->open($dest,ZipArchive::CREATE);
$zip->addFile($filePath,basename($filePath));
$zip->close();
}catch (Exception $ex){
}
}