SplFileObject::fgetc

(PHP 5 >= 5.1.0)

SplFileObject::fgetcGets character from file

說明

public string SplFileObject::fgetc ( void )

Gets a character from the file.

參數

此函式沒有參數。

回傳值

Returns a string containing a single character read from the file or FALSE on EOF.

Warning

本函式可能回傳布林值 FALSE,但也可能回傳一個與 FALSE 等值的非布林值,例如 0 或者 ""。請參閱布林類型章節以獲取更多訊息。應使用 === 運算符來測試本函式的回傳值。

範例

Example #1 SplFileObject::fgetc() example

<?php
$file 
= new SplFileObject('file.txt');
while (
false !== ($char $file->fgetc())) {
    echo 
"$char\n";
}
?>

參見

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top