84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
$fp = fopen('./text.txt', 'rb'); while(!feof($fp)) { echo fgets($fp); //读取一行 } fclose($fp);
好好学习,天天向上!!!
What is rb in fopen()l? What does the feof() function do? -PHP Chinese website Q&A-What is rb in fopen()l? What does the feof() function do? -PHP Chinese website Q&A
Please watch and learn.
fopen — 打开文件或者 URL,首先你不懂的应该是为什么是rb中的b,它是代表二进制的意思。只有r表示只读方式打开,rb表示只读方式打开一个二进制文件。feof — 测试文件指针是否到了文件结束的位置,打开文件读的时候,指针是一行一行的读的,所以要判断一下指针是否已经读到到了最后。
What is rb in fopen()l? What does the feof() function do? -PHP Chinese website Q&A-What is rb in fopen()l? What does the feof() function do? -PHP Chinese website Q&A
Please watch and learn.
fopen — 打开文件或者 URL,首先你不懂的应该是为什么是rb中的b,它是代表二进制的意思。只有r表示只读方式打开,rb表示只读方式打开一个二进制文件。feof — 测试文件指针是否到了文件结束的位置,打开文件读的时候,指针是一行一行的读的,所以要判断一下指针是否已经读到到了最后。