Hier werden die Unterschiede zwischen zwei Versionen gezeigt.
| Both sides previous revision Vorhergehende Überarbeitung | |||
| ziplib [2019/08/10 22:02] webproducer Libzip hinzugefügt | ziplib [2019/09/04 21:40] (aktuell) webproducer GZip | ||
|---|---|---|---|
| Zeile 38: | Zeile 38: | ||
| Dokumentation des Autors: http://valentin.dasdeck.com/php/sfx/files/readme.txt | Dokumentation des Autors: http://valentin.dasdeck.com/php/sfx/files/readme.txt | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== gzip ===== | ||
| + | |||
| + | Gzip ist ein freies, plattformunabhängiges Kompressionsformat. | ||
| + | |||
| + | |||
| + | <code php> | ||
| + | /** | ||
| + | * @param string $filename | ||
| + | */ | ||
| + | private function createGzipFile( &$filename ) | ||
| + | { | ||
| + | $csvContent = file_get_contents( $filename ); // Datei-Inhalt in eine Variable speichern | ||
| + | unlink( $filename ); // Original-Datei entfernen | ||
| + | |||
| + | $filename = $filename . '.gz'; | ||
| + | $fp = gzopen( $filename, 'w9' ); | ||
| + | |||
| + | gzwrite( $fp, $csvContent ); | ||
| + | gzclose( $fp ); | ||
| + | } | ||
| + | |||
| + | </code> | ||