在我们开发的路上,会碰见别人访问我们的接口,并且返回的信息是json 数据量也比较多,出现问题的同时,不好排查,两种方法,一就是写入数据库,另一种就是写入文件,接下来咱们就讲解一下写入文件
$cache_file_path ='D:\phpStudy\WWW\luntan\test\test.txt';
$myfile = fopen($cache_file_path, "w") or die("Unable to open file!");
$txt = "Bill Gates\n";
fwrite($myfile, $txt);
$txt = "Steve Jobs\n"; // 写入内容
fwrite($myfile, $txt);
fclose($myfile);
没什么难度
网友评论