公告:百度等网盘屏蔽本站资源过多,平台会逐渐替换资源下载方式,采用自营云盘下载,网站运营、网盘存储及下载需要成本,故自营网盘下载需要付费,悉知!

php入门学习知识点六 PHP文件的读写操作代码

875 浏览 0 评论


<?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;
?>
标签:

相关推荐

评论区 (0)

暂无评论,快来抢沙发吧~