사이트 내 전체검색
PHP
우분투 php zip 압축 소스
프리이미지
https://cmd.kr/php/883 URL이 복사되었습니다.

본문

apt-get install php-zip

service apache2 restart


파일 배열 받기
$arr_file=array();
foreach($arr_data as $license=>$row) {
       .....
$arr_file[]=$img;
}

// 압축하기
$zip_file="../data/tmp/$bo_table.zip";
createZipInPath($zip_file,$arr_file);

다운로드
echo "<BR><BR><span class='button green large'><a href='$zip_file'>압축 파일 다운로드 $bo_table.zip ";
echo "(".get_filesize(@filesize($zip_file)).")";
echo "</a></span><BR>";


function createZipInPath($create_file, $dirs) {
  $zip = new ZipArchive;
  if($zip->open($create_file, ZipArchive::CREATE)){
    for($i = 0, $len = count($dirs); $i < $len; $i++){
      $zip->addFile($dirs[$i], basename($dirs[$i]));
    }
    $zip->close();
  }else{
    return false;
  }
  return true;
}

 

댓글목록

등록된 댓글이 없습니다.

PHP
871 (2/18P)

Search

Copyright © Cmd 명령어 3.17.148.66