Writing TXT File with PHP, Want to Add an Actual Line Break

后端 未结 5 1578
天命终不由人
天命终不由人 2020-12-16 13:29

I am writing a TXT file using PHP. I want to insert actual line breaks into the TXT file wherever necessary. I have tried all combinations of \\n \\r \\r\\n \\n\\r ... but t

5条回答
  •  伪装坚强ぢ
    2020-12-16 14:04

    You must write \n in a double-quoted string (in single-quoted strings no parsing takes place):

    "foo\r\nbar"
    

    Further reference:

    http://es2.php.net/manual/en/language.types.string.php

提交回复
热议问题