//array
file_put_contents('info.txt', var_export($arr, true) . "\n", FILE_APPEND);
//str
file_put_contents('info.txt', $str . "\n", FILE_APPEND);
本文介绍了一种使用PHP进行文件写入的简单方法,通过数组和字符串两种方式,利用file_put_contents函数实现信息的追加写入。
//array
file_put_contents('info.txt', var_export($arr, true) . "\n", FILE_APPEND);
//str
file_put_contents('info.txt', $str . "\n", FILE_APPEND);
722

被折叠的 条评论
为什么被折叠?