| 注册
请输入搜索内容

热门搜索

Java Linux MySQL PHP JavaScript Hibernate jQuery Nginx
gw23e
10年前发布

PHP解压ZIP文件

function unzip($location,$newLocation)  {          if(exec("unzip $location",$arr)){              mkdir($newLocation);              for($i = 1;$i< count($arr);$i++){                  $file = trim(preg_replace("~inflating: ~","",$arr[$i]));                  copy($location.'/'.$file,$newLocation.'/'.$file);                  unlink($location.'/'.$file);              }              return TRUE;          }else{              return FALSE;          }  }

用法:

<?php  unzip('test.zip','unziped/test'); //File would be unzipped in unziped/test folder  ?>