PHP decompress zip file

WBOY
Release: 2016-07-25 08:45:21
Original
934 people have browsed it
Can decompress zip files. It has two parameters: the path of the compressed file and the path of the target file.
  1. function unzip_file($file, $destination) {
  2. // create object
  3. $zip = new ZipArchive() ;
  4. // open archive
  5. if ($zip->open($file) !== TRUE ) {
  6. die ('Could not open archive');
  7. }
  8. // extract contents to destination directory
  9. $zip->extractTo($destination);
  10. // close archive
  11. $zip->close();
  12. echo 'Archive extracted to directory';
  13. }
Copy code

Unzip, PHP, zip


Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template