This article mainly introduces the functions of php to realize the decompression function. It has a 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; } }
Related recommendations:
php multi-file compression function
The above is the detailed content of PHP function to implement decompression function. For more information, please follow other related articles on the PHP Chinese website!