Is this the most efficient way to get and remove first line in file?

前端 未结 12 2248
天命终不由人
天命终不由人 2020-12-03 03:53

I have a script which, each time is called, gets the first line of a file. Each line is known to be exactly of the same length (32 alphanumeric chars) and terminates with \"

12条回答
  •  無奈伤痛
    2020-12-03 04:14

    You could use file() method.

    Gets the first line

    $content = file('myfile.txt');
    echo $content[0];  
    

提交回复
热议问题