función de PHP feof ()
Definición y Uso
Se feof () función comprueba han llegado al final del archivo (EOF).
Si se produce un error, o el archivo puntero al final del archivo (EOF) devuelve TRUE, de lo contrario, devuelve FALSO.
gramática
feof(file)
参数 | 描述 |
---|---|
file | 必需。规定要检查的打开文件。 |
Notas y sugerencias
Consejo: función feof ()para atravesar la longitud de los datos desconocido es útil.
Ejemplos
<?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);
?>
El código anterior es la salida:
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.
Completar Manual de Referencia del Sistema de Archivos PHP