Use the while loop to read the file content by character. 01? Php0203 uses the while loop to read the file content by character 04 feof () to detect whether the file pointer has reached the end of the file: 0506 $ filePathUsersCufficaDesktopaddicte 01
02
03
// Use the while loop to read file content by character
04
// Feof () is used to detect whether the file pointer has reached the end of the file.
05
06
$ FilePath = '/Users/Cuffica/Desktop/addicted. rtf ';
07
$ Fp = fopen ($ filePath, 'r ');
08
While (! Feof ($ fp) {// when the condition is 1 and always true, execute the command repeatedly to enter the endless loop.
09
Echo fgetc ($ fp); // note that the accepted parameter is a handle, not a file name.
10
}
11
12
Fclose ($ fp); // close the file after use
13
14
?>
Author: dark circles
Http://www.bkjia.com/PHPjc/478010.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/478010.htmlTechArticle01? Php 02 03 // use the while loop to read file content by character 04 // feof () used to check whether the file pointer has reached the end of the file 05 06 $ filePath =/Users/Cuffica/Desktop/addicte...