在php格式中,字符之间的空格

问题描述 投票:0回答:1
<?php
        ini_set( display_errors, 1 );
        error_reporting( E_ALL );
        $email = $_POST['myEmail'];
        $name = $_POST['myName'];
        $news = $_POST['news'];

        if($news != 'Yes') 
        $news = 'No';  

        $to = "[email protected]";
        $subject = "Add me to the Launch Day Notification List!";
        $headers = "From:".$email;
        $txt = "This person wishes to be added to the launch day notification list".$name <br>
        "Does this person wish to subscribe to the newsletter?".$news;
        mail($to,$subject,$headers,$txt);
        echo "Thank you for your inquiry, you will be added to our launch day notification list!";
?> 

我的问题是,在$txt部分,我希望$name和$news与句子的最后一个字符之间有间隔。但是,我如何在两个问题之间添加一个分界点,使它们输出如下。

This person wishes to be added to the launch day notification list: name hereDoes this person wish to subscribe to the newsletter? Yes or no here.

php web spacing
1个回答
0
投票

只需添加这样的空格

$txt = "This person wishes to be added to the launch day notification list $name<br>Does this person wish to subscribe to the newsletter? $news";

如果你不是在发送HTML邮件,你应该替换为 <br>"\n" 喜欢

$txt = "This person wishes to be added to the launch day notification list $name\nDoes this person wish to subscribe to the newsletter? $news";
© www.soinside.com 2019 - 2024. All rights reserved.