美文网首页
php写入文件

php写入文件

作者: 风度翩翩的程序猿 | 来源:发表于2020-12-02 15:17 被阅读0次

    在我们开发的路上,会碰见别人访问我们的接口,并且返回的信息是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);
    
    

    没什么难度

    相关文章

      网友评论

          本文标题:php写入文件

          本文链接:https://www.haomeiwen.com/subject/hrfuwktx.html