PHP 무엇이 일어 났는지를 결정하기 위해 feof () 함수
정의 및 사용
무엇이 일어 났는지를 결정하기 위해 feof () 함수 검사 파일 (EOF)의 단부에 도달된다.
오류가 발생하거나, 파일 끝에 파일 포인터 경우 (EOF), 그렇지 않은 경우 false를 반환 TRUE를 반환.
문법
feof(file)
参数 | 描述 |
---|---|
file | 必需。规定要检查的打开文件。 |
팁과주의 사항
팁 : 무엇이 일어 났는지를 결정하기 위해 feof () 함수는 알 수없는 데이터의 길이가 유용 통과합니다.
예
<?php
$file = fopen("test.txt", "r");
//Output a line of the file until the end is reached
while(! feof($file))
{
echo fgets($file). "<br />";
}
fclose($file);
?>
$file = fopen("test.txt", "r");
//Output a line of the file until the end is reached
while(! feof($file))
{
echo fgets($file). "<br />";
}
fclose($file);
?>
가 출력 위의 코드 :
Hello, this is a test file.
There are three lines here.
This is the last line.
There are three lines here.
This is the last line.
PHP 파일 시스템 참조 설명서를 완료