php解压文件

Posted on Posted in php
  1. <?   
  2. $file = 'htdocs.zip';   
  3.   
  4. $path = pathinfo(realpath($file), PATHINFO_DIRNAME);   
  5. echo $path;  
  6. $zip = new ZipArchive;   
  7. $res = $zip->open($file);   
  8. if ($res === TRUE) {   
  9.   // extract it to the path we determined above   
  10.   $zip->extractTo($path);   
  11.   $zip->close();   
  12.   echo "WOOT! $file extracted to $path";   
  13. else {   
  14.   echo "Doh! I couldn't open $file";   
  15. }   
  16. ?>   
» 转载请注明来源:若我若鱼 » php解压文件

Leave a Reply

Your email address will not be published. Required fields are marked *

15 + 4 =