PHP解压ZIP文件

2015-08-09 0 937
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
?>

遇见资源网 php PHP解压ZIP文件 http://www.ox520.com/7925.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务