色尼玛亚洲综合影院,亚洲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壓縮 在線對文件進行壓縮的函數,轉載需保留來源!

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

主站蜘蛛池模板: 乡城县| 会宁县| 穆棱市| 如东县| 石河子市| 南康市| 穆棱市| 东乡族自治县| 静海县| 赤水市| 中山市| 武城县| 山阳县| 石狮市| 木里| 肥东县| 城固县| 崇礼县| 鸡东县| 广南县| 从江县| 大关县| 航空| 连山| 大新县| 揭阳市| 荆州市| 金堂县| 北流市| 普宁市| 康保县| 长寿区| 武城县| 昭通市| 巨鹿县| 澄迈县| 武胜县| 左贡县| 临沧市| 黄龙县| 鲁甸县|