Introduction: 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'>
<HTML>
<Head>
<Title> Read File content </title>
</Head>
<Body>
<?
// 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 ("<HR>");?>
<?
// 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 );
}
?>
<? Print ("<HR>");?>
<?
/* 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 );
}
?>
</Body>
</Html>
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