PHP读取文件内容

WBOY
Release: 2016-06-23 14:28:46
Original
793 people have browsed it

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

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

读取文件内容



 // 打开文件同时打印文件的每一个字符
 if($myFile = fopen("data.txt", "r"))
 {
 while(!feof($myFile))
 {
  $myCharacter = fgetc($myFile);
  print($myCharacter);
 }
 fclose($myFile);
 } 
?>
print("
");?>

 // 打开文件同时打印文件的每一行
 if($myFile = fopen("data.txt", "r"))
 {
  while(!feof($myFile))
  {
   $myLine = fgets($myFile, 255);
   print($myLine);
  }
 fclose($myFile);
 } 
?>
print("
");?>

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




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

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

http://biancheng.dnbcw.info/php/324388.html pageNo:15
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template