php打包程式(線上解壓與線上打包下載源碼)(1/8)_PHP教程

來源:互聯網
上載者:User
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<$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.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/444877.htmlTechArticlephp打包程式(線上解壓與線上打包下載源碼)本程式支援檔案下載解壓與在線壓縮,這樣我們就查以執行個體線上解壓與線上打包下載功能了。...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    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.