Home  >  Article  >  Backend Development  >  Unzip zip online

Unzip zip online

WBOY
WBOYOriginal
2016-07-25 09:02:161274browse
在线解压zip
  1. $zipfile = 'test.zip';
  2. $zipdir = './test/';
  3. $zip = new ZipArchive();
  4. $rs = $zip->open($zipfile);
  5. if($rs !== TRUE)
  6. {
  7. die('Error :'. $rs);
  8. }
  9. $zip->extractTo($zipdir);
  10. $zip->close();
  11. //unlink($zipfile);
  12. $array = array();
  13. if ($handle = opendir($zipdir)) {
  14. while (false !== ($file = readdir($handle))) {
  15. if ($file != "." && $file != "..") {
  16. $array[] = $file;
  17. }
  18. }
  19. closedir($handle);
  20. }
  21. sort($array);
  22. var_dump($array);
复制代码


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