PHP função feof ()
Definição e Uso
São feof () função verifica ter atingido o fim do arquivo (EOF).
Se ocorrer um erro, ou o ponteiro do arquivo para o final do arquivo (EOF) retorna TRUE, caso contrário, retorna FALSE.
gramática
feof(file)
参数 | 描述 |
---|---|
file | 必需。规定要检查的打开文件。 |
Dicas e Notas
Tip: função feof ()para atravessar o comprimento dos dados é desconhecido útil.
Exemplos
<?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);
?>
O código acima exibirá:
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.
Manual Completo PHP Sistema de Arquivos de Referência