色尼玛亚洲综合影院,亚洲3atv精品一区二区三区,麻豆freexxxx性91精品,欧美在线91

PHP Zip壓縮 在線對(duì)文件進(jìn)行壓縮的函數(shù)

復(fù)制代碼 代碼如下:
/* creates a compressed zip file */
function create_zip($files = array(),$destination = '',$overwrite = false) {
//if the zip file already exists and overwrite is false, return false
if(file_exists($destination) && !$overwrite) { return false; }
//vars
$valid_files = array();
//if files were passed in...
if(is_array($files)) {
//cycle through each file
foreach($files as $file) {
//make sure the file exists
if(file_exists($file)) {
$valid_files[] = $file;
}
}
}
//if we have good files...
if(count($valid_files)) {
//create the archive
$zip = new ZipArchive();
if($zip->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;
}
}
/***** Example Usage ***/
$files=array('file1.jpg', 'file2.jpg', 'file3.gif');
create_zip($files, 'myzipfile.zip', true);

php Zip 文件在線解壓縮的函數(shù)代碼

php技術(shù)PHP Zip壓縮 在線對(duì)文件進(jìn)行壓縮的函數(shù),轉(zhuǎn)載需保留來(lái)源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 明溪县| 电白县| 理塘县| 昌平区| 宣化县| 蓬安县| 礼泉县| 黑河市| 灵寿县| 东海县| 中卫市| 合川市| 新沂市| 马公市| 榆社县| 留坝县| 海安县| 五指山市| 蒙阴县| 西乡县| 德令哈市| 遵义县| 盈江县| 吕梁市| 津南区| 民勤县| 东辽县| 兰溪市| 温州市| 徐汇区| 东丰县| 临夏县| 三台县| 五河县| 曲靖市| 嘉义县| 雅江县| 荆州市| 化州市| 东安县| 博罗县|