<font face="courier new, courier, mono" color="#0000ff" size="3"> <hr> <br><br><title>读取文件内容</title> <br><br><br><br> // 打开文件同时打印文件的每一个字符<br> if($myFile = fopen("data.txt", "r"))<br> {<br> while(!feof($myFile))<br> {<br> $myCharacter = fgetc($myFile);<br> print($myCharacter);<br> }<br> fclose($myFile);<br> } <br>?><br> print("<hr>");?><br><br> // 打开文件同时打印文件的每一行<br> if($myFile = fopen("data.txt", "r"))<br> {<br> while(!feof($myFile))<br> {<br> $myLine = fgets($myFile, 255);<br> print($myLine);<br> }<br> fclose($myFile);<br> } <br>?><br> print("<hr>");?><br><br> /* 打开文件同时打印文件的每一行,<br> 同时去掉取回字符串中的 HTML 语言<br> */<br> if($myFile = fopen("data.txt", "r"))<br> {<br> while(!feof($myFile))<br> {<br> $myLine = fgetss($myFile, 255);<br> print($myLine);<br> }<br> fclose($myFile);<br> } <br>?><br><br> <hr> <br><br><img alt="" hspace="0" src="http://img.bitscn.com/upimg/php/20070123/11E54bH4F2aA.jpg" align="baseline" border="0"></font>