fgetc() - 语法

string fgetc ( resource $handle );

它从给定的文件指针中获取一个字符。

handle.   -  文件指针必须有效,并且必须指向通过fopen()fsockopen()成功打开的文件(但尚未被fclose()关闭)。

fgetc() - 返回值

它返回一个字符串,其中包含从Handle指向的文件读取的单个字符,在EOF上返回FALSE。

fgetc() - 示例

<?php
   $file_open=fopen('sample.txt', 'rw');
   
   if (!$file_open) {
      echo 'Could not open file somefile.txt';
   }
   
   while (false !== ($char=fgetc($file_open))) {
      echo "$char\n";
   }
?>

参考链接

https://www.learnfk.com/php/php-function-fgetc.html