PHP Packaging Program (online decompression and online packaging download source code) This program supports file download decompression and online compression, so we look at the example of online decompression and online packaging download function.
PHP Tutorial Packaging Program (online decompression and online packaging download source code)
This program supports file download decompression and online compression, so we look at the instance of online decompression and online packaging download function.
*/
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
http://www.bkjia.com/PHPjc/444877.html www.bkjia.com true http://www.bkjia.com/PHPjc/444877.html techarticle PHP Packaging Program (online decompression and online packaging download source code) This program supports file download decompression and online compression, so we look at the example of online decompression and online packaging download function. ...