PHP fwrite new line

后端 未结 4 980
遇见更好的自我
遇见更好的自我 2020-12-03 04:36

I\'m trying to write username and password to a new line in a txt file. The output should be something like this in the txt file. I know this is not very secure but its just

4条回答
  •  孤城傲影
    2020-12-03 04:52

    Use PHP_EOL which produces \r\n or \n

    $data = 'my data' . PHP_EOL . 'my data';
    $fp = fopen('my_file', 'a');
    fwrite($fp, $data);
    fclose($fp);
    

    // File output

    my data
    my data
    

提交回复
热议问题