PHP解压ZIP文件
时间:2021-07-01 10:21:17
帮助过:22人阅读
- 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;
- }
- }
用法: - unzip('test.zip','unziped/test'); //File would be unzipped in unziped/test folder
- ?>
|
PHP, ZIP