PHP ob_gzhandler() Funzione
❮ Funzioni di controllo dell'output PHP
Esempio
Aggiungi la compressione gzip a una pagina:
<?php
ob_start("ob_gzhandler");
echo "Hello World!";
?>
Definizione e utilizzo
Questa funzione deve essere passata come callback a ob_start()
. Comprime il contenuto del buffer di output utilizzando un algoritmo di compressione supportato dal browser e restituisce il contenuto compresso. Invia anche un'intestazione HTTP che indica quale algoritmo di compressione è stato utilizzato.
Sintassi
Se utilizzato come richiamata per ob_start()
:
ob_start("ob_gzhandler");
Se usato da solo:
ob_gzhandler(buffer, phase);
Valori dei parametri
Parameter | Description |
---|---|
buffer | The contents of the output buffer |
phase | A bitmask which may have any number of the following flags: PHP_OUTPUT_HANDLER_START - If the output buffer was just created PHP_OUTPUT_HANDLER_FLUSH - If the output buffer is currently being flushed PHP_OUTPUT_HANDLER_FINAL - If the output buffer will be deleted right after this operation |
Dettagli tecnici
Valore di ritorno: | Restituisce una stringa contenente il contenuto compresso |
---|---|
Versione PHP: | 4.0.4+ |
❮ Funzioni di controllo dell'output PHP