phpwind8.7整站太大了,超过5G,导致pclzip类无法压缩成一个文件,尝试很多办法,create文件列表方式也不行,文件太多,32位操作系统的失败,(我在64位上是测试成功的)。
最后用一个笨办法,分别压缩附件文件夹,就是那个for循环。
<?php
include "pclzip.lib.php";
set_time_limit(0);
$path = dirname(__FILE__);
function zipdirs($dir,$zipfile){
echo "<br><b>开始压缩...</b><br>";
$archive = new PclZip($zipfile);
$v_list = $archive->create($dir);
if ($v_list == 0) {
die("Error : ".$archive->errorInfo(true));
}
else
echo '压缩成功!'.$zipfile.'<br>';
flush();
}
//zipdirs();
//exit();
$fzipname='_20150708.zip';
$d=mktime(1, 1, 1, 1, 10, 2005);
$cur='';
$dirfirst='../asmobile/';
$arr = array();
$arr[]='aCloud';
$arr[]='actions';
$arr[]='admin';
$arr[]='api';
$arr[]='apps';
$arr[]='attachment130822';
$arr[]='connexion';
$arr[]='data';
$arr[]='hack';
$arr[]='hook';
$arr[]='htm_data';
$arr[]='html';
$arr[]='images';
$arr[]='ipdata';
$arr[]='js';
$arr[]='lang';
$arr[]='lib';
$arr[]='m';
$arr[]='mode';
$arr[]='native';
$arr[]='require';
$arr[]='simple';
$arr[]='template';
$arr[]='u';
$arr[]='uc_client';
$arr[]='wap';
$arr[]='attachment/cn_img';
$arr[]='attachment/diary';
$arr[]='attachment/forumlogo';
$arr[]='attachment/mini';
$arr[]='attachment/module';
$arr[]='attachment/mutiupload';;
$arr[]='attachment/postcate';;
$arr[]='attachment/pushpic';;
$arr[]='attachment/space';;
$arr[]='attachment/upload';;
$arr[]='attachment/thumb/diary';
$arr[]='attachment/thumb/mini';
for($i=1;;$i++){
$dn=$d+$i*60*60*24*10;
$sur_data_s=substr(date("Ym",$dn),2);
if($cur==$sur_data_s)
continue;
$cur=$sur_data_s;
$arr[]='attachment/Mon_'.$cur;
$arr[]='attachment/thumb/Mon_'.$cur;
$arr[]='attachment/photo/Mon_'.$cur;
if($dn>time())
break;
}
foreach($arr as $v)
{
$dirall=$dirfirst.$v;
if(is_dir($dirall)){
$zipfilename=str_replace("/","-",$v).$fzipname;
echo '['.$dirall.']'.$zipfilename.'<br />';
zipdirs($dirall,$zipfilename);
}
}
echo '<br />finish.';
阅读(1387) | 评论(0) | 转发(0) |