日本不卡不码高清免费观看,久久国产精品久久w女人spa,黄色aa久久,三上悠亚国产精品一区二区三区

您的位置:首頁技術文章
文章詳情頁

PHP擴展之壓縮與歸檔擴展3——Zip

瀏覽:176日期:2022-09-15 15:14:44

此擴展可以讓你透明地讀寫ZIP壓縮文檔以及它們里面的文件。

在PHP5.2以后,為了使用這些函數,必須在編譯 PHP 時用?--enable-zip?配置選項來提供 zip 支持。

Example #1 創建一個 Zip 歸檔

<?php $zip = new ZipArchive(); $filename = './test112.zip'; if ($zip->open($filename, ZIPARCHIVE::CREATE)!==TRUE) {exit('cannot open <$filename>n'); } $zip->addFromString('testfilephp.txt' . time(), '#1 This is a test string added as testfilephp.txt.n'); $zip->addFromString('testfilephp2.txt' . time(), '#2 This is a test string added as testfilephp2.txt.n'); $zip->addFile($thisdir . '/too.php','/testfromfile.php'); echo 'numfiles: ' . $zip->numFiles . 'n'; echo 'status:' . $zip->status . 'n'; $zip->close();?>

Example #2 輸出文檔細節和列表

<?php $za = new ZipArchive(); $za->open(’test_with_comment.zip’); print_r($za); var_dump($za); echo 'numFiles: ' . $za->numFiles . 'n'; echo 'status: ' . $za->status . 'n'; echo 'statusSys: ' . $za->statusSys . 'n'; echo 'filename: ' . $za->filename . 'n'; echo 'comment: ' . $za->comment . 'n'; for ($i=0; $i<$za->numFiles;$i++) {echo 'index: $in';print_r($za->statIndex($i)); } echo 'numFile:' . $za->numFiles . 'n';?>

Example #3 Zip 流封裝,讀取一個 OpenOffice 文件的元信息

<?php $reader = new XMLReader(); $reader->open(’zip://’ . dirname(__FILE__) . ’/test.odt#meta.xml’); $odt_meta = array(); while ($reader->read()) {if ($reader->nodeType == XMLREADER::ELEMENT) { $elm = $reader->name;} else { if ($reader->nodeType == XMLREADER::END_ELEMENT && $reader->name == ’office:meta’) {break; } if (!trim($reader->value)) {continue; } $odt_meta[$elm] = $reader->value;} } print_r($odt_meta);?>

此例使用了舊的 API(PHP 4),它打開了一個 ZIP 文件歸檔,讀取歸檔里的每個文件,并輸出文件內容。此例用到的?test2.zip?文檔是 ZZIPlib 源分布里測試文檔中的一個。

Example #4 Zip 使用范例

<?php $zip = zip_open('/tmp/test2.zip'); if ($zip) {while ($zip_entry = zip_read($zip)) { echo 'Name: ' . zip_entry_name($zip_entry) . 'n'; echo 'Actual Filesize: ' . zip_entry_filesize($zip_entry) . 'n'; echo 'Compressed Size: ' . zip_entry_compressedsize($zip_entry) . 'n'; echo 'Compression Method: ' . zip_entry_compressionmethod($zip_entry) . 'n'; if (zip_entry_open($zip, $zip_entry, 'r')) { echo 'File Contents:n'; $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry)); echo '$bufn'; zip_entry_close($zip_entry); } echo 'n';}zip_close($zip); }?>

?ZipArchive 類

ZipArchive::addEmptyDir?— Add a new directoryZipArchive::addFile?— Adds a file to a ZIP archive from the given pathZipArchive::addFromString?— Add a file to a ZIP archive using its contentsZipArchive::addGlob?— Add files from a directory by glob patternZipArchive::addPattern?— Add files from a directory by PCRE patternZipArchive::close?— Close the active archive (opened or newly created)ZipArchive::deleteIndex?— delete an entry in the archive using its indexZipArchive::deleteName?— delete an entry in the archive using its nameZipArchive::extractTo?— Extract the archive contentsZipArchive::getArchiveComment?— Returns the Zip archive commentZipArchive::getCommentIndex?— Returns the comment of an entry using the entry indexZipArchive::getCommentName?— Returns the comment of an entry using the entry nameZipArchive::getFromIndex?— Returns the entry contents using its indexZipArchive::getFromName?— Returns the entry contents using its nameZipArchive::getNameIndex?— Returns the name of an entry using its indexZipArchive::getStatusString?— Returns the status error message, system and/or zip messagesZipArchive::getStream?— Get a file handler to the entry defined by its name (read only).ZipArchive::locateName?— Returns the index of the entry in the archiveZipArchive::open?— Open a ZIP file archiveZipArchive::renameIndex?— Renames an entry defined by its indexZipArchive::renameName?— Renames an entry defined by its nameZipArchive::setArchiveComment?— Set the comment of a ZIP archiveZipArchive::setCommentIndex?— Set the comment of an entry defined by its indexZipArchive::setCommentName?— Set the comment of an entry defined by its nameZipArchive::statIndex?— Get the details of an entry defined by its index.ZipArchive::statName?— Get the details of an entry defined by its name.ZipArchive::unchangeAll?— Undo all changes done in the archiveZipArchive::unchangeArchive?— Revert all global changes done in the archive.ZipArchive::unchangeIndex?— Revert all changes done to an entry at the given indexZipArchive::unchangeName?— Revert all changes done to an entry with the given name.

相關函數

zip_close?— Close a ZIP file archivezip_entry_close?— Close a directory entryzip_entry_compressedsize?— Retrieve the compressed size of a directory entryzip_entry_compressionmethod?— Retrieve the compression method of a directory entryzip_entry_filesize?— Retrieve the actual file size of a directory entryzip_entry_name?— Retrieve the name of a directory entryzip_entry_open?— Open a directory entry for readingzip_entry_read?— Read from an open directory entryzip_open?— Open a ZIP file archivezip_read?— Read next entry in a ZIP file archive
標簽: PHP
相關文章:
日本不卡不码高清免费观看,久久国产精品久久w女人spa,黄色aa久久,三上悠亚国产精品一区二区三区
免费在线成人网| 在线亚洲免费| 精品国产鲁一鲁****| 超级白嫩亚洲国产第一| 国产h片在线观看| 美女在线视频一区| 久久99精品久久久久久园产越南| 国产精品中文字幕亚洲欧美| 国产美女久久| 麻豆国产一区| 97精品在线| 天堂网av成人| 妖精视频成人观看www| 精品1区2区3区4区| 免费久久精品视频| 91精品丝袜国产高跟在线| 国产欧美三级| 精品不卡一区| 国产伊人精品| 亚洲精品123区| 亚洲精品九九| 日韩av片子| 丝袜脚交一区二区| 麻豆精品新av中文字幕| 美女久久久久| 精品三级国产| 日韩av资源网| 日本一区二区免费高清| 亚洲精品网址| 日本综合精品一区| 精品国产亚洲一区二区三区大结局| 国产网站在线| 国产一区一一区高清不卡| 国产一区二区三区四区五区传媒 | 日本免费一区二区三区四区| 久久精品系列| 国产精品xxx| 99久久夜色精品国产亚洲1000部| 美美哒免费高清在线观看视频一区二区| 欧美在线91| 欧美日韩精品免费观看视完整| 午夜一级在线看亚洲| 国产精品主播在线观看| 欧美色图国产精品| 日本午夜精品久久久久| 国产成人精品一区二区三区视频| 欧美日韩国产在线观看网站| 亚洲精品护士| 久久只有精品| 亚洲一区二区三区高清不卡| 国产麻豆一区二区三区精品视频| 日韩免费福利视频| 日韩精品午夜视频| 韩国精品主播一区二区在线观看| 日韩手机在线| 日本欧美不卡| 欧美啪啪一区| 欧美日韩精品在线一区| 日韩高清不卡一区二区| 日韩欧美综合| 日韩1区2区3区| 免费污视频在线一区| 日韩精品福利一区二区三区| 久久蜜桃精品| 国产精品亚洲一区二区在线观看| 免费av一区二区三区四区| 国产乱码精品| 欧美精品黄色| 精品国产亚洲一区二区在线观看| 巨乳诱惑日韩免费av| 福利精品一区| 日本在线不卡视频一二三区| 日韩在线第七页| 91欧美日韩在线| 激情久久久久久久| 麻豆精品久久久| 亚洲综合图色| 久久精品网址| 日本在线视频一区二区| 欧美日韩在线网站| 精品中国亚洲| 日韩av三区| 久久福利一区| 成人精品亚洲| 久久午夜影院| 日韩av中文在线观看| 亚洲一区二区三区四区五区午夜| 超碰在线99| 国产剧情在线观看一区| 日韩中文字幕麻豆| 国产专区一区| 久久国内精品| 三级欧美韩日大片在线看| av在线资源| 国产日产高清欧美一区二区三区| 首页欧美精品中文字幕| 国产一区导航| 久久久久久久久丰满| 国产成人精品亚洲线观看| 亚洲18在线| 老牛国产精品一区的观看方式| 在线一区视频观看| 久久久久久久欧美精品| 视频二区不卡| 亚洲黄色网址| 精品国产美女a久久9999| 国产亚洲精品美女久久 | 国产福利一区二区三区在线播放| 美国三级日本三级久久99| 亚洲精品1区| 亚洲国产成人精品女人| 久久婷婷激情| 成人看片网站| 99久久夜色精品国产亚洲1000部| www.九色在线| 麻豆理论在线观看| 国产91在线播放精品| 久久精品色播| 福利一区在线| 日韩电影免费在线观看| 国产精品久久久久久久久妇女| 国产极品模特精品一二| 国产精品色婷婷在线观看| 91精品国产自产在线丝袜啪| 亚洲制服一区| 日韩精品第一| 久久国内精品| 国产精品高清一区二区| 另类综合日韩欧美亚洲| 精品国产不卡一区二区| 精品国产a一区二区三区v免费| 精品三级av| 国产精品亚洲一区二区三区在线观看| 吉吉日韩欧美| 色88888久久久久久影院| 日本一区二区高清不卡| 日韩精品第一区| 日韩理论视频| 激情欧美国产欧美| 国产精品s色| 国产91在线精品| 欧美午夜精品一区二区三区电影| 香蕉国产精品| 亚洲三区欧美一区国产二区| 日本精品一区二区三区在线观看视频| 亚洲精品国产日韩| 国产欧美一区二区三区精品观看| 久久精品亚洲| 久久一级电影| 综合欧美精品| 亚洲综合在线电影| 国产亚洲在线观看| 三级在线观看一区二区 | 日韩精品国产欧美| 国产精品一二| 蜜桃成人精品| 国产精品呻吟| 视频一区视频二区中文| 天堂va欧美ⅴa亚洲va一国产| 欧美亚洲自偷自偷| 美女视频黄免费的久久| 给我免费播放日韩视频| 国产 日韩 欧美一区| 亚洲专区在线| 国产区精品区| 麻豆精品久久| 天堂资源在线亚洲| 中文字幕一区二区三区在线视频| 欧美精品国产一区| 女生影院久久| 老鸭窝毛片一区二区三区| 日韩国产在线观看| 免费高潮视频95在线观看网站| 在线国产一区二区| 日韩二区三区在线观看| 国产精品久久久久蜜臀 | 欧美日韩国产免费观看视频| 亚洲免费毛片| 国产日韩欧美中文在线| 精品国产欧美| 在线精品福利| 99久久激情| 激情婷婷久久| 日本不卡在线视频| 日本中文字幕一区二区视频| 日韩av影院| 亚洲成人不卡| 日韩不卡一区二区| 久久久久国产精品一区二区| 蜜桃久久av一区| 欧美日韩国产观看视频| 四虎精品一区二区免费| 欧美xxxx中国| 亚洲理论在线| 精品国内亚洲2022精品成人| 亚洲欧美日韩精品一区二区| 国产福利91精品一区二区| 亚洲久久在线| 999国产精品永久免费视频app| 欧美久久久网站|