テキストファイルへのデータの書き込みを実行するたびに、どうすれば改行できますか?
ファイルは改行なしでレコードを表示します:
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);