现在的位置: 首页 > 综合 > 正文

PHP读取文件内容

2012年05月28日 ⁄ 综合 ⁄ 共 836字 ⁄ 字号 评论关闭

简介:这是PHP读取文件内容的详细页面,介绍了和php,有关的知识、技巧、经验,和一些php源码等。

class='pingjiaF' frameborder='0' src='http://biancheng.dnbcw.info/pingjia.php?id=324388' scrolling='no'>


<HTML>
<HEAD>
<TITLE>读取文件内容</TITLE>
</HEAD>
<BODY>
<?
 // 打开文件同时打印文件的每一个字符
 if($myFile = fopen("data.txt", "r"))
 {
 while(!feof($myFile))
 {
  $myCharacter = fgetc($myFile);
  print($myCharacter);
 }
 fclose($myFile);
 } 
?>
<? print("<hr>");?>
<?
 // 打开文件同时打印文件的每一行
 if($myFile = fopen("data.txt", "r"))
 {
  while(!feof($myFile))
  {
   $myLine = fgets($myFile, 255);
   print($myLine);
  }
 fclose($myFile);
 } 
?>
<? print("<hr>");?>
<?
 /* 打开文件同时打印文件的每一行,
 同时去掉取回字符串中的 HTML 语言
 */
 if($myFile = fopen("data.txt", "r"))
 {
  while(!feof($myFile))
  {
   $myLine = fgetss($myFile, 255);
   print($myLine);
  }
  fclose($myFile);
 } 
?>
</BODY>
</HTML>


“PHP读取文件内容”的更多相关文章 》

爱J2EE关注Java迈克尔杰克逊视频站JSON在线工具

http://biancheng.dnbcw.info/php/324388.html pageNo:15

抱歉!评论已关闭.