作成方法
ネットを検索すると5系のexecなどを使わないとできないという情報のみだったのですが、PHP7.2以上は作成が可能です!
<?php
$zip = new ZipArchive;
$res = $zip->open('test.zip', ZipArchive::CREATE);
if ($res === TRUE) {
$zip->addFromString('test.txt', 'file content goes here');
$zip->setEncryptionName('test.txt', ZipArchive::EM_AES_256, 'password');
$zip->close();
}
ぜひ、お試しください!