fgetc() FunctionReads a character from the file pointer. The function may return the boolean value false, but it may also return a non-boolean equivalent of false, such as 0 or "".
Syntax
fgetc(file)
Parameters file Required. Specifies the documents to be checked.
Returns a string containing one character obtained from the file pointed to by file. Returns false if EOF is encountered.
The file pointer must be valid and must point to a file that was successfully opened by fopen() or fsockopen() (but has not been closed by fclose()).
Code Example
<?php $fh = @fopen("test.txt","r") or die("打开 test.txt 文件出错!"); if($fh){ while(!feof($fh)) { echo fgetc($fh); } } fclose($fh); ?>
The above is the detailed content of Instructions for using the php fgetc() function. For more information, please follow other related articles on the PHP Chinese website!