ZIP a file and protect with a password in PHP

前端 未结 5 979
一整个雨季
一整个雨季 2020-12-18 04:33

I\'m having this code to zip files but i need to protect this file with a password

$file = \'backup.sql\';
$zipname = $file.\'.zip\';
$zip = new ZipArchive;
         


        
5条回答
  •  暖寄归人
    2020-12-18 05:18

    Since PHP 7.2 you can use setEncryptionName to create password protected ZIP archive.

提交回复
热议问题