PHP的ZIP壓縮處理包 TbsZip 2.10 發布

fmms 13年前發布 | 9K 次閱讀 PHP

TbsZip 是一個 PHP 的類用來讀寫 Zip 壓縮文件包,該類無需 PHP 擴展或者是臨時文件。TbsZip 可以對壓縮文檔中的文件進行讀、寫、修改和刪除操作。

TbsZip 2.10 發布了,該版本修復了一些小bug以及PHP提醒消息的問題。

示例:

$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

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