당신은 PHP ZipArchive library을 사용할 수 있습니다.
도 code example from the documentation 유용 할 것입니다.
<?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 builtin function chmod.
사용할 수 있습니다
chmod("/somedir/somefile", 0600);
사용할 수있는 파일을 삭제하려면, 예를 들어 php builtin unlink
,
unlink('test.html');
unlink('testdir');
나는 PHP 공식 문서를 살펴보기 위해 yuo를 강력히 추천한다.
공식 PHP 5.2 defalt apache php의 "PHP ZipArchive library"부분입니까? – Rella
그리고 그 zip 파일을 어디에서 삭제합니까? – Rella
@Ole 예, ZipArchive는 공식 배포판을 제공합니다. 그러나 그것은 http://www.zlib.net/ – phoenix24