php 远程下载zip并解压到当前目录下代码
<?php
function unzip($filePath,$path) {
if (empty($path) || empty($filePath)) {
return false;
}
$zip = new ZipArchive();
if ($zip->open($filePath) === true) {
$zip->extractTo($path);
$zip->close();
return true;
} else {
return false;
}
}
copy("https://xxxx.com/file.zip","./file.zip");
$filePath='./file.zip';
$path='./';
unzip($filePath,$path);
unlink('./file.zip');