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

search for in the

SplFileObject::fgetss> <SplFileObject::fgetcsv
[edit] Last updated: Fri, 18 Sep 2009

view this page in

SplFileObject::fgets

(PHP 5 >= 5.1.0)

SplFileObject::fgetsGets line from file

Описание

public string SplFileObject::fgets ( void )

Gets a line from the file.

Параметри

Тази функция няма параметри.

Връщани стойности

Returns a string containing the next line from the file, or FALSE on error.

Грешки/Изключения

Throws a RuntimeException if the file cannot be read.

Примери

Example #1 SplFileObject::fgets example

This example simply outputs the contents of file.txt line-by-line.

<?php
$file 
= new SplFileObject("file.txt");
while (!
$file->eof()) {
    echo 
$file->fgets();
}
?>

Вж. също



add a note add a note User Contributed Notes SplFileObject::fgets
There are no user contributed notes for this page.

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