file_put_contents跟fwrite读写文件的区别

WBOY
Release: 2016-06-13 12:39:33
Original
973 people have browsed it

file_put_contents和fwrite读写文件的区别
第一种:

<br />
$james=fopen("index.htm","a");<br />
fwrite($james,$rose);<br />
fclose($james);<br />
Copy after login

第二种:
<br />
file_put_contents('index.htm',$rose);<br />
Copy after login

这两种方法读写文件有啥区别吗?第二种一行代码就够了,所以经常用第二种。什么情况下用第一种,什么情况下用第二种?有何利弊?

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template