TbsZip 2.14 發布,PHP的ZIP文件解壓縮類

jopen 11年前發布 | 22K 次閱讀 TbsZip

版本說明:現在你以從一個PHP文件句柄,打開一個壓縮包。

TbsZip 是一個 PHP 的類用來讀寫 Zip 壓縮文件包,該類無需 PHP 擴展或者是臨時文件。TbsZip 可以對壓縮文檔中的文件進行讀、寫、修改和刪除操作。
它甚至可以開始用一個空的存檔。原存檔就不會被修改。新的存檔可以作為一個新的文件保存在服務器上,或直接提供HTTP下載,甚至為一個二進制字符串。 Zlib壓縮擴展在PHP中被激活,之后TbsZip就可以自動壓縮和解壓存檔中的文件
示例:

$zip = new clsTbsZip(); // instantiate the class

$zip->Open('archive1.zip'); // open an existing zip archive

$ok = $zip->FileExists('innerfolder/subfile1.txt'); // check if a sub-file exist in the archive

$txt = $zip->FileRead('subfile2.txt'); // retrieve the content of a sub-file

... // some work on the $txt contents

$zip->FileReplace('subfile2.txt', $txt, TBSZIP_STRING); // replace the existing sub-file

$zip->FileReplace('subfile3.txt', false); // delete the existing sub-file

$zip->FileAdd('subfile4.txt', $txt3, TBSZIP_STRING); // add a new sub-file

$zip->Flush(TBSZIP_FILE, 'archive1_new.zip'); // flush the modifications as a new archive

$zip->Close(); // close the current archive</pre>項目地址: http://www.tinybutstrong.com/apps/tbszip/tbszip_help.html  

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!