tags:

views:

106

answers:

3

Hello, is there an easy way to open and create a zip with PHP?

+4  A: 

Have a look at the PHP Zip library. Here are a few tutorials on the subject:

Marius
+3  A: 

Something like the zip library ?

Damien MATHIEU
+3  A: 

Take a look at the documentation for ZipArchive, particularly the open method.

You use it like this:

<?php
$zip = new ZipArchive;
if ($zip->open('test.zip') === TRUE) {
    $zip->addFile('/path/to/index.txt', 'newname.txt');
    $zip->close();
    echo 'ok';
} else {
    echo 'failed';
}
?>
Dominic Rodger