Zip Fájl függvények (csak olvasáshoz)
Bevezetés
This module enables you to transparently read ZIP compressed archives and the files inside them.
Követelmények
Ez a modul a » ZZIPlib könyvtár függvényeit használja. A ZZIPlib-et Guido Draheimnek köszönhetjük. A ZZIPlib 0.10.6 vagy késÅ‘bbi kiadására van szükség.
Vedd figyelembe, hogy a ZZIPlib csak a teljes zip imlementációnak megfelelÅ‘ tömörÃtett zip fájlokat kezeli. A zip programkészletre is szükség van ahhoz, hogy zip fájlokat olvasson a modul.
TelepÃtés
PHP 4
Note: Zip support before PHP 4.1.0 is experimental.
Because the PHP 4 zip extension is unmaintained we recommend that the PECL extension is used rather than the bundled one.
Linux systems
In order to use these functions you must compile PHP with zip support by using the --with-zip[=DIR] configure option, where [DIR] is the prefix of the » ZZIPlib library install.
Windows
Windows users need to enable php_zip.dll inside of php.ini in order to use these functions.
PHP 5.2.0 and later
Linux systems
In order to use these functions you must compile PHP with zip support by using the --enable-zip configure option.
Windows
Windows users need to enable php_zip.dll inside of php.ini in order to use these functions.
Installation via PECL
További információk, mint például új kiadások, letöltés, forrásállományok, karbantartók, CHANGELOG találhatóak itt: » https://pecl.php.net/package/zip.
Ezen PECL kiterjesztés DLL állományát letöltheted a » PHP Letöltések, vagy a » https://snaps.php.net/ cÃmrÅ‘l.
A PHP 4-es változatában ennek a kiterjesztésnek a DLL állománya (Windows esetében) az extensions/ könyvtár alatt található meg.
Futásidejű beállÃtások
Ez a kiterjesztés semmilyen konfigurációs beállÃtásokat nem definiál a php.ini állományban.
ErÅ‘forrás tÃpusok
Ez a kiterjesztés semmilyen erÅ‘forrás tÃpust nem definiál.
Előre definiált állandók
Ez a kiterjesztés semmilyen konstans értéket nem definiál.
Példák
Az alábbi példa megnyit egy zip állományt, beolvassa a benne található fájlokat és kinyomtatja tartalmukat. A példában felhasznált test2.zip állomány a ZZIPlib csomag egyik "beépÃtett" próba állománya.
Example#1 Példaprogram
<?php
$zip = zip_open("/tmp/test2.zip");
if ($zip) {
while ($zip_entry = zip_read($zip)) {
echo "Név: " . zip_entry_name($zip_entry) . "\n";
echo "TömörÃtetlen méret: " . zip_entry_filesize($zip_entry) . "\n";
echo "TömörÃtett méret: " . zip_entry_compressedsize($zip_entry) . "\n";
echo "TömörÃtési metódus: " . zip_entry_compressionmethod($zip_entry) . "\n";
if (zip_entry_open($zip, $zip_entry, "r")) {
echo "A fájl tartalma:\n";
$buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
echo "$buf\n";
zip_entry_close($zip_entry);
}
echo "\n";
}
zip_close($zip);
}
?>
A program elÅ‘ször megnyitja a megadott útvonalon található test2.zip fájlt. A ciklust addig végzi, amÃg a a zip_read() egy érvényes $zip_entry (vagyis a zip állományban létezÅ‘ fájl vagy könyvtár) értékkel tér vissza. A zip_read() tulajdonképpen egy tömb eléréseként képzelhetÅ‘, amely tömbbe a zip_open() betölti a megnyitott zip állományban lévÅ‘ fájlok neveit. Minden egyes ciklusnál a program automatikusan elÅ‘re lépteti a tömböt eggyel.
Table of Contents
- zip_close — Lezár egy megnyitott ZIP állományt
- zip_entry_close — Lezár egy ZIP állományban található objektumot
- zip_entry_compressedsize — Egy zip-ben lévÅ‘ objektum tömörÃtett méretét adja meg
- zip_entry_compressionmethod — A megadott zip objektum tömörÃtési tÃpusát adja meg
- zip_entry_filesize — Az adott zip objektum tömörÃtetlen fájlméretét adja vissza
- zip_entry_name — A zip objektum nevével tér vissza
- zip_entry_open — Olvasásra megnyit egy zip objektumot
- zip_entry_read — Olvas egy megnyitott zip objektumból
- zip_open — Megnyit egy zip állományt
- zip_read — Beolvassa a következő elemet a ZIP állományból
- ZipArchive::addEmptyDir — Add a new directory
- ZipArchive::addFile — Adds a file to a ZIP archive from the given path
- ZipArchive::addFromString — Add a file to a ZIP archive using its contents
- ZipArchive::close — Close the active archive (opened or newly created)
- ZipArchive::deleteIndex — delete an entry in the archive using its index
- ZipArchive::deleteName — delete an entry in the archive using its name
- ZipArchive::extractTo — Extract the archive contents
- ZipArchive::getArchiveComment — Returns the Zip archive comment
- ZipArchive::getCommentIndex — Returns the comment of an entry using the entry index
- ZipArchive::getCommentName — Returns the comment of an entry using the entry name
- ZipArchive::getFromIndex — Returns the entry contents using its index.
- ZipArchive::getFromName — Returns the entry contents using its name.
- ZipArchive::getNameIndex — Returns the name of an entry using its index
- ZipArchive::getStream — Get a file handler to the entry defined by its name (read only).
- ZipArchive::locateName — Returns the index of the entry in the archive
- ZipArchive::open — Open a ZIP file archive
- ZipArchive::renameIndex — Renames an entry defined by its index
- ZipArchive::renameName — Renames an entry defined by its name
- ZipArchive::setArchiveComment — Set the comment of a ZIP archive
- ZipArchive::setCommentIndex — Set the comment of an entry defined by its index
- ZipArchive::setCommentName — Set the comment of an entry defined by its name
- ZipArchive::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 archive.
- ZipArchive::unchangeArchive — Revert all global changes done in the archive.
- ZipArchive::unchangeIndex — Revert all changes done to an entry at the given index.
- ZipArchive::unchangeName — Revert all changes done to an entry with the given name.