Home > php教程 > PHP开发 > body text

Code for reading text files under more efficient PHP

黄舟
Release: 2016-12-14 11:52:49
Original
1151 people have browsed it

fread: Calculate the length in bytes, read data according to the specified length and number of times, and stop after encountering the end or completing the specified length of reading.
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 function call form 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

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!