downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

Funzioni Zlib> <Costanti predefinite
[edit] Last updated: Fri, 17 May 2013

view this page in

Esempi

Questo esempio apre un file temporaneo e scrive una stringa di prova in esso, quindi stampa il contenuto di questo file due volte.

Example #1 Piccolo Esempio di Zlib

<?php

$filename 
tempnam('/tmp''zlibtest') . '.gz';
echo 
"<html>\n<head></head>\n<body>\n<pre>\n";
$s "Only a test, test, test, test, test, test, test, test!\n";

// apre il file in scrittura con la massima compressione
$zp gzopen($filename"w9");

// scrive una stringa nel file
gzwrite($zp$s);

// chiude il file
gzclose($zp);

// apre il file in lettura
$zp gzopen($filename"r");

// legge 3 caratteri
echo gzread($zp3);

// stampa fino alla fine del file e lo chiude.
gzpassthru($zp);
gzclose($zp);

echo 
"\n";

// apre il file e stampa il contenuto (per la seconda volta).
if (readgzfile($filename) != strlen($s)) {
        echo 
"Error with zlib functions!";
}
unlink($filename);
echo 
"</pre>\n</body>\n</html>\n";

?>


add a note add a note User Contributed Notes Esempi - [0 notes]
There are no user contributed notes for this page.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites