ZipArchive::setPassword

(PHP 5 >= 5.6.0, PHP 7, PHP 8, PECL zip >= 1.12.4)

ZipArchive::setPasswordSet the password for the active archive

Descrizione

public ZipArchive::setPassword(#[\SensitiveParameter] string $password): bool

Sets the password for the active archive.

Elenco dei parametri

password

The password to be used for the archive.

Valori restituiti

Restituisce true in caso di successo, false in caso di fallimento.

Note

Nota:

As of PHP 7.2.0 and libzip 1.2.0 the password is used to decompress the archive, and is also the default password for ZipArchive::setEncryptionName() and ZipArchive::setEncryptionIndex(). Formerly, this function only set the password to be used to decompress the archive; it did not turn a non-password-protected ZipArchive into a password-protected ZipArchive.

Vedere anche: