displaying multiple lines of a file, never repeating

后端 未结 4 1328
执笔经年
执笔经年 2020-12-04 02:48

i need to, for every ten lines, echo them in a div.

example:

line 1 line 2 ... line 9 line 10
4条回答
  •  孤城傲影
    2020-12-04 03:10

    With a quick google search:

    http://www.w3schools.com/php/php_file.asp

    Reading a File Line by Line

    The fgets() function is used to read a single line from a file.

    Note: After a call to this function the file pointer has moved to the next line.

    Example from W3 Schools:

    The example below

    reads a file line by line, until the end of file is reached:

    ";
      }
    fclose($file);
    ?>
    

    All you need to do is have your counting variable that counts up to 10 within that while loop. once it hits 10, do what you need to do.

提交回复
热议问题