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

PHP Zip壓縮 在線對文件進行壓縮的函數

復制代碼 代碼如下:
/* 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 文件在線解壓縮的函數代碼

php技術PHP Zip壓縮 在線對文件進行壓縮的函數,轉載需保留來源!

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

主站蜘蛛池模板: 依兰县| 株洲市| 和硕县| 改则县| 沐川县| 米脂县| 玉环县| 勃利县| 千阳县| 石门县| 九台市| 大埔区| 株洲县| 龙游县| 班戈县| 望江县| 搜索| 建德市| 上饶县| 自贡市| 射洪县| 商洛市| 怀集县| 双牌县| 沭阳县| 金华市| 射阳县| 珲春市| 鄱阳县| 正蓝旗| 靖西县| 岑溪市| 宕昌县| 额尔古纳市| 香格里拉县| 安陆市| 改则县| 炉霍县| 永川市| 玉林市| 长寿区|