PHPZipArchiveライブラリを目的に使用できます。
また、役立つと思われるドキュメントのコード例もあります。
<?php
$zip = new ZipArchive();
$filename = "./test112.zip";
if ($zip->open($filename, ZIPARCHIVE::CREATE)!==TRUE) {
exit("cannot open <$filename>\n");
}
$zip->addFromString("testfilephp.txt" . time(), "#1 This is a test string added as testfilephp.txt.\n");
$zip->addFromString("testfilephp2.txt" . time(), "#2 This is a test string added as testfilephp2.txt.\n");
$zip->addFile($thisdir . "/too.php","/testfromfile.php");
echo "numfiles: " . $zip->numFiles . "\n";
echo "status:" . $zip->status . "\n";
$zip->close();
?>
ファイルのパーミッションを変更するには、PHPの組み込み関数chmodを使用できます。
例えば
chmod("/somedir/somefile", 0600);
使用できるファイルを削除するには、phpビルトインのリンクを解除します
例えば、
unlink('test.html');
unlink('testdir');
yuoに公式のPHPドキュメントを確認することを強くお勧めします。