Home >php教程 >php手册 >php打包程序(在线解压与在线打包下载源码)(1/8)

php打包程序(在线解压与在线打包下载源码)(1/8)

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 11:24:131240browse

php打包程序(在线解压与在线打包下载源码)本程序支持文件下载解压与在线压缩,这样我们就查以实例在线解压与在线打包下载功能了。

php教程打包程序(在线解压与在线打包下载源码)
本程序支持文件下载解压与在线压缩,这样我们就查以实例在线解压与在线打包下载功能了。
*/
//phpzip.class.php
class phpzip{
 var $datasec, $ctrl_dir = array();
 var $eof_ctrl_dir = "x50x4bx05x06x00x00x00x00";
 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   {
    $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];
 if(!in_array(dirname($fn[0]),$this->dirs))
     $this->add_dir(dirname($fn[0]));
    if(basename($fn[0]))
     $ret[basename($fn[0])]=$this->add_file($fn[1],$fn[0],$compact);
  }
  return $ret;
 }

1 2 3 4 5 6 7 8

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn