在PHP写入字符串到TXT文件的代码方法
//$file:文件路径,$content要写入的字符串
function put_to_file($file, $content) {
$fopen = fopen($file, 'wb');
if (!$fopen) {
return false;
}
fwrite($fopen, $content);
fclose($fopen);
return true;
}