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

search for in the

gzgetss> <gzgetc
Last updated: Fri, 22 Aug 2008

view this page in

gzgets

(PHP 4, PHP 5)

gzgetsObtiene una línea del archivo apuntado

Descripción

string gzgets ( resource $zp , int $tamaño )

Obtiene a cadena (sin comprimir) de hasta tamaño -1 bytes leídos de el archivo apuntado. La lectura termina cuando tamaño -1 bytes han sido leídos, en un salto de línea o cuando se alcance el fin del archivo (EOF), lo que ocurra primero.

Lista de parámetros

zp

El apuntador al archivo gz. Debe ser válido, y debe apuntar a un fichero abierto exitosamente por gzopen().

tamaño

El tamaño de los datos a obtener.

Valores retornados

La cadena sin comprimir, o FALSE en error.

Ejemplos

Example #1 Ejemplo de gzgets()

<?php
$handle 
gzopen('somefile.gz''r');
while (!
gzeof($handle)) {
   
$buffer gzgets($handle4096);
   echo 
$buffer;
}
gzlose($handle);
?>

Ver también



add a note add a note User Contributed Notes
gzgets
04-Aug-2005 11:21
For the above example by VIJAY, using gzgetc would be better, as I've encountered binary/text file incompatibilities (at least with PHP 4.0.4).
prismngp1 at yahoo dot com
10-Aug-2002 05:19
<?
// this is simple code by VIJAY to unzip .gz file
$file = "/absolute/path/to/your/file" ;
$fp = fopen("$file", "w") ;
// file to be unzipped on your server
$filename = "filename.gz" ;
$zp = gzopen($filename, "r");

if ($zp)
{
  while (!gzeof($zp))
  {
    $buff1 = gzgets ($zp, 4096) ;
    fputs($fp, $buff1) ;
  }               
}           
gzclose($zp) ;
fclose($fp) ;
?>

gzgetss> <gzgetc
Last updated: Fri, 22 Aug 2008
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites