PHP8 ZipArchive::setArchiveComment

2024-02-27 11:09 更新

(PHP 5 >= 5.2.0, PHP 7, PHP 8, PECL zip >= 1.4.0)

ZipArchive::setArchiveComment — 設(shè)置ZIP存檔的注釋

說明

public ZipArchive::setArchiveComment(string $comment): bool

設(shè)置ZIP存檔的注釋。

參數(shù) 

comment

注釋的內(nèi)容。

返回值 

成功時(shí)返回 true, 或者在失敗時(shí)返回 false。

示例 

示例 #1 創(chuàng)建存檔并設(shè)置注釋

<?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';
}
?>


以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)