时间:2021-07-01 10:21:17 帮助过:15人阅读
function zip_files(string $zipName,...$files){
//检测压缩包名称是否正确
$zipExt=strtolower(pathinfo($zipName,PATHINFO_EXTENSION));
if('zip'!==$zipExt){
return false;
}
$zip=new ZipArchive();
if($zip->open($zipName,ZipArchive::CREATE|ZipArchive::OVERWRITE)){
foreach($files as $file){
if(is_file($file)){
$zip->addFile($file);
}
}
$zip->close();
return true;
}else{
return false;
}
}相关推荐:
php解压功能的函数
以上就是php多文件压缩的功能函数 的详细内容,更多请关注Gxl网其它相关文章!