當(dāng)前位置:博客首頁>>PHP >> 閱讀正文

PHP在線壓縮zip函數(shù)-php創(chuàng)建zip

作者: 鄭曉 分類: PHP 發(fā)布于: 2011-05-26 17:57 瀏覽:8,027 沒有評論



open($destination,$overwrite ? ZIPARCHIVE::OVERWRITE : ZIPARCHIVE::CREATE) !== true) {
return false;
}
//add the files
foreach($valid_files as $file) {
$zip->addFile($file,$file);
}
//debug
//echo 'The zip archive contains ',$zip->numFiles,' files with a status of ',$zip->status;
//close the zip -- done!
$zip->close();
//check to make sure the file exists
return file_exists($destination);
}
else
{
return false;
}
}
/***** 應(yīng)用實例 ***/
$files=array('1.php', 'mail.php', 'readme.txt');
create_zip($files, 'myzipfile.zip', true);
?>

? ? ? ?

本文采用知識共享署名-非商業(yè)性使用 3.0 中國大陸許可協(xié)議進行許可,轉(zhuǎn)載時請注明出處及相應(yīng)鏈接。

本文永久鏈接: http://www.yjfs.org.cn/php-function-php-line-compression-to-create-zip-zip.html

發(fā)表評論

change vcode