Home >Backend Development >PHP Tutorial >PHP decompression function function

PHP decompression function function

不言
不言Original
2018-04-20 10:39:161571browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:Class operations in PHPNext article:Class operations in PHP