CreateNew(); // start a new empty archive for adding files // or $zip->Open('an_existing_archive.zip'); // open an existing archive for reading and/or modifying // -------------------------------------------------- // Reading information and data in the opened archive // -------------------------------------------------- // check if a file is existing in the archive, the name must precise subfolders if any $ok = $zip->FileExists('subfolder/help.html'); // count the files stored in the archive $file_nbr = count($zip->CdFileLst); // retrieve the content of an compressed file in the archive $text1 = $zip->FileRead('readme.txt'); // retrieve the content of an compressed file in a subfolder of the archive $text2 = $zip->FileRead('subfolder/readme.txt'); if ($ok) $zip->FileExists('subfolder/help.html'); // ----------------------------- // Modifying data in the archive // ----------------------------- // add a file in the archive $zip->FileAdd('newfile.txt', $data, TBSZIP_STRING); // add the file by giving the content $zip->FileAdd('newpic1.png', './images/localpic1.png', TBSZIP_FILE); // add the file by copying a local file $zip->FileAdd('newpic2.png', './images/localpic2.png', TBSZIP_FILE, false); // add the uncompressed file by copying a local file // delete an existing file in the archive $zip->FileReplace('newfile.txt', $data, TBSZIP_STRING); // replace the file by giving the content $zip->FileReplace('newpic1.png', './images/localpic1.png', TBSZIP_FILE); // replace the file by copying a local file $zip->FileReplace('newpic2.png', './images/localpic2.png', TBSZIP_FILE, false); // replace the uncompressed file by copying a local file $zip->FileReplace('newpic3.png', false); // delete the file in the archive // cancel the last modification on the file (add/replace/delete) $zip->FileCancelModif('newpic2.png'); // ---------------------- // Applying modifications // ---------------------- $zip->Flush(TBSZIP_FILE, './save/new_archive.zip'); // apply modifications as a new local file // apply modifications as an HTTP downloaded file $zip->Flush(TBSZIP_DOWNLOAD, 'download.zip'); $zip->Flush(TBSZIP_DOWNLOAD, 'download.zip', 'application/zip'); // with a specific Content-Type // apply modifications as a downloaded file with your customized HTTP headers header("Content-type: application/force-download"); header("Content-Disposition: attachment; filename=download.zip"); header("Expires: Fri, 01 Jan 2010 05:00:00 GMT"); $zip->Flush(TBSZIP_DOWNLOAD+TBSZIP_NOHEADER); // ----------------- // Close the archive // ----------------- $zip->Close(); // stop to work with the opened archive. Modifications are not applied to the opened archive, use Flush() to commit
陳述
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

AI Hentai Generator
免費產生 AI 無盡。

熱門文章
R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
3 週前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.最佳圖形設置
3 週前By尊渡假赌尊渡假赌尊渡假赌
刺客信條陰影:貝殼謎語解決方案
2 週前ByDDD
R.E.P.O.如果您聽不到任何人,如何修復音頻
3 週前By尊渡假赌尊渡假赌尊渡假赌
WWE 2K25:如何解鎖Myrise中的所有內容
3 週前By尊渡假赌尊渡假赌尊渡假赌

熱工具

Atom編輯器mac版下載
最受歡迎的的開源編輯器

mPDF
mPDF是一個PHP庫,可以從UTF-8編碼的HTML產生PDF檔案。原作者Ian Back編寫mPDF以從他的網站上「即時」輸出PDF文件,並處理不同的語言。與原始腳本如HTML2FPDF相比,它的速度較慢,並且在使用Unicode字體時產生的檔案較大,但支援CSS樣式等,並進行了大量增強。支援幾乎所有語言,包括RTL(阿拉伯語和希伯來語)和CJK(中日韓)。支援嵌套的區塊級元素(如P、DIV),

MantisBT
Mantis是一個易於部署的基於Web的缺陷追蹤工具,用於幫助產品缺陷追蹤。它需要PHP、MySQL和一個Web伺服器。請查看我們的演示和託管服務。

Dreamweaver Mac版
視覺化網頁開發工具

記事本++7.3.1
好用且免費的程式碼編輯器