ZipArchive::setArchiveComment

(PHP 5 >= 5.2.0, PHP 7, PECL zip >= 1.4.0)
Set the comment of a ZIP archive
bool ZipArchive::setArchiveComment ( string $comment )

Set the comment of a ZIP archive.

Parameters:
comment

The contents of the comment.

Returns:

Returns TRUE on success or FALSE on failure.

Examples:
Create an archive and set a comment
1
2
3
4
5
6
7
8
9
10
11
12
<?php
$zip new ZipArchive;
$res $zip->open('test.zip', ZipArchive::CREATE);
if ($res === TRUE) {
    $zip->addFromString('test.txt''file content goes here');
    $zip->setArchiveComment('new archive comment');
    $zip->close();
    echo 'ok';
else {
    echo 'failed';
}
?>
doc_php
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.