小白教程
所有教程
关于
Search
172.71.254.7
172.71.254.7
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Func filesystem feof”的源代码
本页内容
上一节:
Func_filesystem_fclose
下一节:
Func_filesystem_fflush
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:feof()}}[[Category:PHP Filesystem 文件系统参考手册|12]] = PHP feof() 函数 = [[Category:PHP Filesystem 文件系统参考手册]] == 定义和用法 == feof() 函数检查是否已到达文件末尾(EOF)。 如果出错或者文件指针到了文件末尾(EOF)则返回 TRUE,否则返回 FALSE。 == 语法 == <pre> feof(file) </pre> {| class="table table-striped table-hover" ! 参数 ! 描述 |- | file | 必需。规定要检查的打开文件。 |} == 提示和注释 == '''提示:'''feof() 函数对遍历长度未知的数据很有用。 以下实例输出文件的每一行,直到最后一行结束: <sample title="" desc="" lang="php" hererun="1"> <?php $file = fopen("test.txt", "r"); // 输出文件的每一行直到文件结尾 while(! feof($file)) { echo fgets($file). "<br />"; } fclose($file); ?> </sample> 上面的代码将输出: <sample title="" desc="" lang="php" hererun="1"> Hello, this is a test file. There are three lines here. This is the last line. </sample> [[Category:PHP Filesystem 文件系统参考手册]]
返回至“
Func filesystem feof
”。
上一节:
Func_filesystem_fclose
下一节:
Func_filesystem_fflush