file_put_contents函数怎么写入数据 

解决方案 »

  1.   

    使用fwrite和file_put_contents函数写入数据 <?php
     $filepath = "05.txt";
     $str = "此情可待成追忆 只是当时已惘然<br>";
     echo "用fwrite函数写入文件:";
     $fopen = fopen($filepath,'wb') or die('文件不存在');
     fwrite($fopen,$str);
     fclose($fopen);
     readfile($filepath);
     echo "<p>用file_put_contents函数写入文件:";
     file_put_contents($filepath,$str);
     readfile($filepath);
    ?>http://www.phpzc.com/read.php?tid-690.html
      

  2.   

    遇到什么问题吗?
    若问用法,请参考PHP手册以及相关页面实例
      

  3.   

    http://www.phpzc.com/read.php?tid-690.html 这个上面是个完整例子吧  不过还是谢谢二楼