PHP: Read Specific Line From File

后端 未结 12 652
天命终不由人
天命终不由人 2020-11-28 08:15

I\'m trying to read a specific line from a text file using php. Here\'s the text file:

foo  
foo2

How would I get the content of the seco

12条回答
  •  臣服心动
    2020-11-28 09:04

    You have to loop the file till end of file.

      while(!feof($file))
      {
         echo fgets($file). "
    "; } fclose($file);

提交回复
热议问题