日期:2013-06-12 浏览次数:20487 次
<?php
// Created by bouchon
// http://dev.maxg.info
// Need help ? http://forum.maxg.info
class ZipLib{
var $datasec = array();
var $ctrl_dir = array();
var $eof_ctrl_dir = "\x50\x4b\x05\x06\x00\x00\x00\x00";
var $old_offset = 0;
var $dirs = array(".");
function get_List($zip_name){
$zip = @fopen($zip_name, 'rb');
if(!$zip) return(0);
$centd = $this->ReadCentralDir($zip,$zip_name);
@rewind($zip);
@fseek($zip, $centd['offset']);
for ($i=0; $i<$centd['entries']; $i++){
$header = $this->ReadCentralFileHeaders($zip);
$header['index'] = $i;
$info['filename'] = $header['filename'];
$info['stored_filename'] = $header['stored_filename'];
$info['size'] = $header['size'];
$info['compressed_size'] = $header['compressed_size'];
$info['crc'] = strtoupper(dechex( $header['crc'] ));
$info['mtime'] = $header['mtime'];
$info['comment'] = $header['comment'];
$info['folder'] = ($header['external']==0x41FF0010||$header['external']==16)?1:0;
$info['index'] = $header['index'];$info['status'] = $header['status'];
$ret[] = $info;
unset($header);
}
return $ret;
}
function Add($files,$compact){
if(!is_array($files[0])){
$files = array($files);
}
for($i=0;$files[$i];$i++){
$fn = $files[$i];