php fgets() function


  Translation results:

英[get] 美[ɡɛt]

vt. Get; catch; persuade; receive (punishment, etc.)

vt.& vi. Arrive, come

vi.Become; start; try to deal with; obtain benefits or wealth

n.Reproduction, cub; profit

Third person singular: gets Present participle: getting Past tense: got Past participle: gotgot

php fgets() functionsyntax

Function: Read a line from the file pointer.

Syntax: fgets(file,length)

Parameters:

ParametersDescription
file Required. Specifies the file to be read.
length Optional. Specifies the number of bytes to read. The default is 1024 bytes.

Description: Read a line from the file pointed to by file and return a string with a length of at most length - 1 byte. Stops when a newline character (included in the return value), EOF, or length - 1 bytes has been read (whichever occurs first). If length is not specified, it defaults to 1K, or 1024 bytes. On failure, returns false.

php fgets() functionexample

<?php
$file = fopen("./test.txt","r");
echo fgets($file);
?>

Home

Videos

Q&A