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

源码网商城

PHP 处理TXT文件(打开/关闭/检查/读取)

  • 时间:2022-12-05 17:53 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:PHP 处理TXT文件(打开/关闭/检查/读取)
php文件处理:[url=http://www.1sucai.cn/w3school/php/php_file.htm]http://www.1sucai.cn/w3school/php/php_file.htm[/url]
[u]复制代码[/u] 代码如下:
<?php $filename=dirname(__FILE__)."/readfrom.txt"; $ofilename=dirname(__FILE__)."/writeto.txt"; if(!file_exists($filename)){ echo $filename." not found!"; exit; } $fp=fopen($filename,"r"); $fo = fopen($ofilename,"w"); while(!feof($fp)){ $record=fgets($fp); if($record!=NULL){ $record_arr=explode("\t", $record); fwrite($fo,$record,strlen($col)); } } fclose($fo); fclose($fp); ?>
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部