php入门学习知识点六 PHP文件的读写操作代码
代码如下:
<?php //打开文件 $fp=fopen('tmp.html', 'r'); //读取文件内容 可以用以下两个函数进行操作 fread,file_get_contents $str=fread($fp, filesize('tmp.html')); //filesize为获取文件大小 $content=file_get_contents('tmp.html'); //写文件 $news=fopen('news.html', 'w'); fwrite($news, $content); //关闭文件流 fclose($fp); fclose($news); echo $content; ?>
相关推荐
mathchao 2020-10-28
zyyjay 2020-11-09
xuebingnan 2020-11-05
samtrue 2020-11-22
stefan0 2020-11-22
yifangs 2020-10-13
songshijiazuaa 2020-09-24
hebiwtc 2020-09-18
天步 2020-09-17
83911535 2020-11-13
whatsyourname 2020-11-13
zhouyuqi 2020-11-10
Noneyes 2020-11-10
王志龙 2020-10-28
wwwsurfphpseocom 2020-10-28
diskingchuan 2020-10-23
savorTheFlavor 2020-10-23