每次将数据写入文本文件后,如何换行?
该文件是在无换行符中显示记录:
countryId:20, productId:332, status:1, opId:188, xId:pdgje9876, countryId:20, productId:334, status:0, opId:188, xId:pfgje3455,
这是我需要的输出:
countryId:20, productId:332, status:1, opId:188, xId:pdgje9876,
countryId:20, productId:334, status:0, opId:188, xId:pfgje3455,
$txt = "log.txt";
$fh = fopen($txt, 'a') or die("can't open file");
foreach($obj as $key => $value) {
print "$key => $value<br>";
$stringData = $key.":".$value.", ";
fwrite($fh, $stringData);
}
fclose($fh);