1
我想要的代碼,使樹中的所有文件在根ZipArchive .zip文件顯示所有文件在根
<?PHP
// create object
$zip = new ZipArchive();
// open archive
if ($zip->open('my-archive.zip', ZIPARCHIVE::CREATE) !== TRUE) {
die ("Could not open archive");
}
// list of files to add
// list of files to add
$fileList = array(
'im/asd.pdf',
'im/df.pdf',
'im/d/qoyyum.txt'
);
// add files
foreach ($fileList as $f) {
$zip->addFile($f) or die ("ERROR: Could not add file: $f");
}
// close and save archive
$zip->close();
echo "Archive created successfully.";
?>
例如文件夾.zip文件/ IM含有
/im/asd.pdf
/im/df.pdf
/im/d/qoyyum.txt
的「my-archive.zip」提取物應該是這樣的
my-archive/asd.pdf
my-archive/df.pdf
my-archive/qoyyum.txt
我想阻止的文件夾層次提取拉鍊時。讓每一個文件都應該在提取的ZIP文件夾的根
請建議小費做
謝謝,它的工作 – 2011-04-15 09:50:02
偉大的解決方案,jackbot。 – 2bard 2011-04-15 11:14:23