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

PHP Zip壓縮 在線對文件進行壓縮的函數(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壓縮 在線對文件進行壓縮的函數(shù),轉(zhuǎn)載需保留來源!

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

主站蜘蛛池模板: 阳高县| 巴林左旗| 南岸区| 杭锦后旗| 珠海市| 新乡县| 若羌县| 察隅县| 麻栗坡县| 汝阳县| 阿拉善盟| 库尔勒市| 鄯善县| 屏东县| 四会市| 遵义县| 闽侯县| 历史| 绥棱县| 武陟县| 六安市| 华安县| 彭州市| 宿州市| 万山特区| 台东市| 永靖县| 博客| 洪泽县| 通化县| 张掖市| 黑山县| 黄大仙区| 昌图县| 巩义市| 疏勒县| 潍坊市| 图片| 延吉市| 琼结县| 乌兰察布市|