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

search for in the

gzgetss> <gzgetc
[edit] Last updated: Fri, 17 May 2013

view this page in

gzgets

(PHP 4, PHP 5)

gzgetsGzipli dosya tanıtıcısından bir satır döndürür

Açıklama

string gzgets ( resource $dt , int $uzunluk )

Belirtilen dosya tanıtıcısında mevcut konumdan itibaren en fazla (sıkıştırılmamış) uzunluk - 1 bayt okur. Okuma işlemi uzunluk - 1 baytta, ilk satırsonu karakterinde veya dosya sonuna gelindiğinde (hangisi önce olursa) durur.

Değiştirgeler

dt

Gzipli dosya tanıtıcısı. gzopen() tarafından açılmış bir dosyayı gösteren geçerli bir tanıtıcı olmalıdır.

uzunluk

Okunacak verinin uzunluğu.

Dönen Değerler

Bir hata oluşursa FALSE aksi takdirde sıkıştırılmamış dizgeyi döndürür.

Örnekler

Örnek 1 - gzgets() örneği

<?php
$dt 
gzopen('birdosya.gz''r');
while (!
gzeof($dt)) {
   
$tampon gzgets($dt4096);
   echo 
$tampon;
}
gzclose($dt);
?>

Ayrıca Bakınız

  • gzopen() - Bir gzipli dosya açar
  • gzgetc() - Gzipli dosya göstericisindeki karakteri döndürür
  • gzwrite() - Bir dizgeyi bir gzipli dosyaya ikil kipte yazar



add a note add a note User Contributed Notes gzgets - [2 notes]
up
1
prismngp1 at yahoo dot com
10 years ago
<?
// 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) ;
?>
up
0
Anonymous
7 years ago
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).

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