Introduction to PHP file reading: this is a detailed page for PHP to read file content. it introduces php, related knowledge, skills, experience, and some php source code.
Class = 'pingjiaf' frameborder = '0' src = 'http: // biancheng.dnbc?info/pingjia.php? Id = 324388 'Rolling = 'no'>
Read file content
// Open the file and print every character of the file
If ($ myFile = fopen ("data.txt", "r "))
{
While (! Feof ($ myFile ))
{
$ MyCharacter = fgetc ($ myFile );
Print ($ myCharacter );
}
Fclose ($ myFile );
}
?>
// Print each row of the file while opening the file
If ($ myFile = fopen ("data.txt", "r "))
{
While (! Feof ($ myFile ))
{
$ MyLine = fgets ($ myFile, 255 );
Print ($ myLine );
}
Fclose ($ myFile );
}
?>
/* Open the file and print each row of the file,
Remove the HTML language from the retrieved string.
*/
If ($ myFile = fopen ("data.txt", "r "))
{
While (! Feof ($ myFile ))
{
$ MyLine = fgetss ($ myFile, 255 );
Print ($ myLine );
}
Fclose ($ myFile );
}
?>
More articles about "PHP reading file content"
Love J2EE follow Java Michael Jackson video station JSON online tools
Http://biancheng.dnbcw.info/php/324388.html pageNo: 15.