将数据写入文件函数fwrite()相当于fputs()函数file_put_contents()(PHP基础教程)
- //将数据写入文件 fwrite() 相当于fputs() file_put_contents()
- $aa = 'aa.txt';
- $str = '自丢网www.zidiu.com';
- $fopen = fopen($aa,'wb') or die('文件不存在');
- fwrite($fopen,$str);
- fclose($fopen);
- readfile($aa);
- $hehe = '测试效果';
- file_put_contents($aa,$hehe); //覆盖 输出 测试效果
- readfile($aa);
- unlink('zidiu.txt'); //删除文件
复制代码
|
|