Home > Backend Development > PHP Tutorial > PHP packaging program (online decompression and online packaging and downloading source code) (1/8)_PHP tutorial

PHP packaging program (online decompression and online packaging and downloading source code) (1/8)_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-20 11:08:20
Original
869 people have browsed it

PHP packaging program (online decompression and online packaging and downloading source code) This program supports file downloading, decompression and online compression, so we will check the online decompression and online packaging and downloading functions with examples.

php tutorial packaging program (online decompression and online packaging and downloading source code)
This program supports file downloading, decompression and online compression, so we can check the online decompression and online packaging and downloading functions with examples.
*/
//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<$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];
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

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/444877.htmlTechArticlephp packaging program (online decompression and online packaging and downloading source code) This program supports file downloading, decompression and online compression, so we Let’s check out the online decompression and online package download functions for examples. ...
Statement of this Website
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template