首页 > 其他 > 详细

将数据写入TXT文件中,file_put_contents与fwrite

时间:2016-02-14 18:13:35      阅读:167      评论:0      收藏:0      [点我收藏+]
<?php
header("content-type:text/html;charset=utf-8");

$file = ‘./aa.txt‘;
###判断是不是文件
if(is_file($file)){
####判断是不是可写
if(is_writable($file)){
   // echo "yes";
    ###判断文件是不是可读
    if(false !== ($handle=fopen($file,‘a‘))){
     // echo 1;
        ###执行写入操作
        $content="56789 \r\n";
// file_put_contents($file,$content,FILE_APPEND); //用于装载执行失败的数据 fwrite($handle,$content); ###效果同上 fclose($handle); }else{ echo "no open"; } }else{ echo "no write!"; } }else{ echo "no file"; } ?>

 

将数据写入TXT文件中,file_put_contents与fwrite

原文:http://www.cnblogs.com/wuheng1991/p/5189349.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!