This article mainly introduces the functions of PHP decompression function, which has certain reference value. Now I share it with everyone. Friends in need can refer to it
function unzip_file(string $zipName,string $dest){ //检测要解压压缩包是否存在 if(!is_file($zipName)){ return false; } //检测目标路径是否存在 if(!is_dir($dest)){ mkdir($dest,0777,true); } $zip=new ZipArchive(); if($zip->open($zipName)){ $zip->extractTo($dest); $zip->close(); return true; }else{ return false; } }
The above is the detailed content of PHP decompression function function. For more information, please follow other related articles on the PHP Chinese website!