源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

PHP 读取文件内容代码(txt,js等)

  • 时间:2022-01-24 09:19 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:PHP 读取文件内容代码(txt,js等)
<?php /* 作者:bjf; 应用:读取文件内容; */ function read_file_content($FileName) { //open file $fp=fopen($FileName,"r"); $data=""; while(!feof($fp)) { //read the file $data.=fread($fp,4096); } //close the file fclose($fp); //delete the file //unlink($FileName); //return the content from the file echo $data; } read_file_content("a.html") ?> fread与fgets的区别 fread :以字节位计算长度,按照指定的长度和次数读取数据,遇到结尾或完成指定长度读取后停止. fgets :整行读取,遇到回车换行或结尾停止.在文本方式时使用.
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部