(PHP 5 >= 5.2.0, PHP 7, PECL zip >= 1.1.0)
ZipArchive::extractTo — 锟斤拷压锟斤拷锟侥硷拷
锟斤拷压锟斤拷锟侥硷拷锟斤拷压锟斤拷锟斤拷指锟斤拷锟斤拷目录
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';
}
?>