Feof determines whether the fgets ends or gets an empty line, which results in more rows being read.

when opening a file using fopen
while (! feof ($File)) {

)
$arr = explode("\t", trim(fgets($File)));
echo $arr[1];

}

when making a judgment, because the last line of the open file is a blank line, use the index value of the array to output the value with notice error PHP Notice: Undefined offset would like to ask, is there any way to deal with the problem that the last line is a blank line when reading this file?

Php
Mar.17,2021

while($sRow = fgets($oFile,1024))
{
    if($sRow == "\n")
        break;
    echo $sRow;
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3ea85-2c435.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3ea85-2c435.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?