PHP Packaging Program (online decompression and online packaging download source code) (1/8) _php Tutorial

Source: Internet
Author: User
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. ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.