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, 25 May 2012

view this page in

SplFileObject::fgets

(PHP 5 >= 5.1.0)

SplFileObject::fgetsファイルから 1 行取り出す

説明

public string SplFileObject::fgets ( void )

ファイルから 1 行取り出します。

パラメータ

この関数にはパラメータはありません。

返り値

ファイルから次の行を含む文字列、もしくはエラーのときは FALSE を返します。

エラー / 例外

ファイルが読み込みできない場合 RuntimeException がスローされます。

例1 SplFileObject::fgets() の例

この例では file.txt の内容が 1 行ごとに出力されます。

<?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