Home  >  Article  >  php教程  >  php feof函数

php feof函数

WBOY
WBOYOriginal
2016-06-13 11:17:441010browse

如果文件指针到了 EOF 或者出错时则返回 TRUE,否则返回一个错误(包括 socket 超时),其它情况则返回 FALSE。  

定义和用法
feof() 函数检测是否已到达文件末尾 (eof)。

如果文件指针到了 eof 或者出错时则返回 true,否则返回一个错误(包括 socket 超时),其它情况则返回 false。

语法
feof(file)参数 描述
file 必需。规定要检查的打开文件。

说明
file 参数是一个文件指针。这个文件指针必须有效,并且必须指向一个由 fopen() 或 fsockopen() 成功打开(但还没有被 fclose() 关闭)的文件。

 


$fh = fopen("/home/www.bkjia.com/data/users.txt", "rt");
while (!feof($fh)) echo fgets($fh);
fclose($fh);
?>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn