PHP: how to open a zip
is there an easy way to open and create a zip with PHP开发者_运维百科?
Have a look at the PHP Zip library. Here are a few tutorials on the subject:
- Devzone.zend.com
- net.tutsplus.com
Something like the zip library ?
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';
}
?>
精彩评论