SORU
6 Kasım 2012, Salı


Nasıl bir dosya satır okumak için php line

Nasıl tamamen bellekte yüklemeden PHP satırı ile dosya satır okumak?

Dosyamı ben her zaman bellek hatası egzoz var yani bellekte açmak için çok büyük.

Dosya boyutu 1Gb.

CEVAP
6 Kasım 2012, Salı


fgets() dosyayı satır satır okumak için işlevini kullanabilirsiniz:

$handle = fopen("inputfile.txt", "r");
if ($handle) {
    while (($line = fgets($handle)) !== false) {
        // process the line read.
    }

    fclose($handle);
} else {
    // error opening the file.
} 

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:
Php

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • cdgotx

    cdgotx

    8 Kasım 2011
  • Matt Stokes

    Matt Stokes

    22 Ocak 2008
  • Phymec

    Phymec

    18 Temmuz 2009