zip圧縮 展開 PHPコード
zip・圧縮 zip.php
<?php
set_time_limit(60); //timeout
$dir = “./backup”; //path
$file = “xxx.zip”; //zip file
system(“zip -r $file $dir > /dev/null”); //nolog
?>
unzip・展開 unzip.php
<?php
set_time_limit(60); //timeout
$zip = new ZipArchive;
$res = $zip$zip = new ZipArchive;
$res = $zip->open(‘wordpress-4.4-ja.zip’);
if ($res === TRUE) {
$zip->extractTo(‘./’);
$zip->close();
echo ‘done’;
} else {
echo ‘fail’;
}
?>