ZipArchive::extractTo
(PHP 5 >= 5.2.0, PHP 7, PECL zip >= 1.1.0)
ZipArchive:::extractTo - 提取存档内容
描述
bool ZipArchive::extractTo ( string $destination [, mixed $entries ] )
将完整档案或给定文件解压缩到指定的目标。
参数
destination
提取文件的位置。
entries
要提取的条目。它接受单个条目名称或一个名称数组。
返回值
成功时返回TRUE
或失败时返回FALSE
。
示例
Example #1 Extract all entries
<?php
$zip?=?new?ZipArchive;
if?($zip->open('test.zip')?===?TRUE)?{
????$zip->extractTo('/my/destination/dir/');
????$zip->close();
????echo?'ok';
}?else?{
????echo?'failed';
}
?>
Example #2 Extract two entries
<?php
$zip?=?new?ZipArchive;
$res?=?$zip->open('test_im.zip');
if?($res?===?TRUE)?{
????$zip->extractTo('/my/destination/dir/',?array('pear_item.gif',?'testfromfile.php'));
????$zip->close();
????echo?'ok';
}?else?{
????echo?'failed';
}
?>
← ZipArchive::deleteName
ZipArchive::getArchiveComment →
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com