首页 视频课程 开发基础PHP 基础 PHP文本文件操作

PHP文本文件操作

2020-03-07 / 5494阅

本视频需要登录以后才能播放

登录

创建并打开一个文本文件,在文本中追加内容或者读取文本中的内容

经常用作日志记录。

<?php
$myfile = fopen("newfile.txt", "w") or die("Unable to open file!");
$txt = "Bill Gates\n";
fwrite($myfile, $txt);
$txt = "Steve Jobs\n";
fwrite($myfile, $txt);
fclose($myfile);
?> 

阅读文章或者观看视频过程中有任何问题,请下方留言或者联系我Q248758228

大家谈论
    我的见解