PHP new line break in emails

后端 未结 8 1757
闹比i
闹比i 2020-11-27 20:35

I have the following code:

$message = \"Good news! The item# $item_number on which you placed a bid of \\$ $bid_price is now available for purchase at your b         


        
8条回答
  •  眼角桃花
    2020-11-27 21:16

    When we insert any line break with a programming language the char code for this is "\n". php does output that but html can't display that due to htmls line break is
    . so easy way to do this job is replacing all the "\n" with "
    ". so the code should be

    str_replace("\n","
    ",$str);

    after adding this code you wont have to use pre tag for all the output oparation.

    copyed this ans from this website :

提交回复
热议问题