PHP Doku:: Schließt das aktive Archiv (geöffnet oder neu erstellt) - function.ziparchive-close.html

Verlauf / Chronik / History: (12) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzErweiterungen zur Datenkompression und ArchivierungZipThe ZipArchive classZipArchive::close

Ein Service von Reinhard Neidl - Webprogrammierung.

The ZipArchive class

<<ZipArchive::addFromString

ZipArchive::deleteIndex>>

ZipArchive::close

(PHP 5 >= 5.2.0, PECL zip >= 1.1.0)

ZipArchive::closeSchließt das aktive Archiv (geöffnet oder neu erstellt)

Beschreibung

bool ZipArchive::close ( void )

Schließt das geöffnete oder neu erstellte Archiv und speichert die Änderungen. Diese Methode wird am Ende des Skripts automatisch aufgerufen.

Parameter-Liste

Diese Funktion hat keine Parameter.

Rückgabewerte

Gibt bei Erfolg TRUE zurück. Im Fehlerfall wird FALSE zurückgegeben.


3 BenutzerBeiträge:
- Beiträge aktualisieren...
john factorial
29.12.2010 21:58
If you're adding multiple files to a zip and your $zip->close() call is returning FALSE, ensure that all the files you added actually exist. Apparently $zip->addFile() returns TRUE even if the file doesn't actually exist. It's a good idea to check each file with file_exists() or is_readable() before calling $zip->addFile() on it.
jared at kippage dot com
3.09.2009 3:08
It may seem a little obvious to some but it was an oversight on my behalf.

If you are adding files to the zip file that you want to be deleted make sure you delete AFTER you call the close() function.

If the files added to the object aren't available at save time the zip file will not be created.
gilthans at gmail dot com
22.10.2007 20:16
Don't forget to check the zip isn't empty, folks - otherwise the zip won't be created at all, and the server will issue no warning!

I used a certain loop to add files to the zip, and struggled with permissions and documentation for hours before I realize the loop ended up adding no file, even though addFile WAS called, but on a non-existent file.
This might be the reason your zips aren't popping up.



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)