私は別の行に2つの名前(フォームデータ)を書き込むために以下のコードを取得しようとしています。 Atomで.txtファイルを開くと別の行に表示されますが、メモ帳では1行にしか表示されません。代わりに\n
または\r\n
の自分の行にある.txtファイルの名前に書き込むPHPコード
<?php
error_reporting(E_ERROR | E_PARSE);
$nameOne = $_POST['nameOne'];
$nameTwo = $_POST['nameTwo'];
$newfile = fopen("newfile.txt", "w");
$txt = "$nameOne\n";
fwrite($newfile, $txt);
$txt = "$nameTwo\n";
fwrite($newfile, $txt);
fclose($newfile);
?>
異なる編集者がEOL(End Of Line)をどのように解釈しているか、さまざまな[表現](https://en.wikipedia.org/wiki/Newline#Representations)を見てみるとちょっと違いますか? –
この "$ nameOne" .PHP_EOL; –