tags:

views:

38

answers:

1

how to create an empty zip archve by php some thing like new -> zip archive

+5  A: 

You were pretty close:

$zip = new ZipArchive();
$zip->open('my-archive.zip', ZipArchive::CREATE);

// To actually save the archive you have to put some file/dir into it
$zip->addFromString('tmp', '');
$zip->close();

You can find out more on PHP's manual pages.

Crozin
its not create any thing
moustafa
It seems that you have to add some file/directory to the archive to save it what makes a perfect sense cause what's the point of an empty archive?
Crozin