Home > Article > Backend Development > Code for reading text files under more efficient PHP original_PHP tutorial
fread: Calculate the length in bytes, read data according to the specified length and number of times, and stop when the end is encountered or the specified length of reading is completed.
fgets: Read the entire line, and stop when encountering a carriage return or line feed or the end. Used in text mode.
Read string function The function of fgets function is to read a string from the specified file into a character array.
The form of function call is:
fgets(character array name, n, file pointer);
where n is a positive integer.
means that the string read from the file does not exceed n-1 characters.
Add the end of string mark' after the last character read
http://www.bkjia.com/PHPjc/319246.html
www.bkjia.com
true
http: //www.bkjia.com/PHPjc/319246.html
TechArticle
fread: Calculate the length in bytes, read data according to the specified length and number of times, encounter the end or complete Stop after reading the specified length. fgets: Read the entire line and stop when encountering a carriage return or line feed or the end. In the text...