PHP - Manual: SplFileObject::fgetc
2024-11-15
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
SplFileObject::fgetc — Gets character from file
Gets a character from the file.
此函数没有参数。
Returns a string containing a single character read from the file or false
on EOF.
示例 #1 SplFileObject::fgetc() example
<?php
$file = new SplFileObject('file.txt');
while (false !== ($char = $file->fgetc())) {
echo "$char\n";
}
?>