fgetcsv skip blank lines in file

前端 未结 3 870
小鲜肉
小鲜肉 2021-01-04 09:26

I have this script that I did, it basically grabs all the files in my \"logs\" folder and merge them all in one array file, my only problem is that, sometimes the script bre

3条回答
  •  攒了一身酷
    2021-01-04 10:18

    This works 100% tested, simplest way. The explanation is that blank lines make fgetcsv return a non-empty array with just a null element inside.

    if ($result[0] == NULL)
        continue;
    

提交回复
热议问题