文件操作

fopen()

 

  

fwrite()

 

 

 

注:1,返回的是一个整型,代表写入的字符数

        2,重新fwrite后原文件被新写入的内容覆盖

fclose()

 

 

 

file_get_contents

file_get_contents() 函数把整个文件读入一个字符串

 

file_put_contents

file_put_contents() 函数把一个字符串写入文件中。

 

注意:1,读取或写入的文件路径不能是绝对路径(不能是/开头,只能是完整的路径或相对路径)

      2,file_put_contents会覆盖文件已有的数据

原文地址:https://www.cnblogs.com/jdbeyond/p/11519754.html