开发者

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';
}
?>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜