猿问

php形式的字符之间的空格

<?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 = "web@myemail.com";

        $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 以及句子的最后一个字符之间留出空格。而且,我如何在两个问题之间添加一个中断,以便它们输出如下:


此人希望被添加到发布日通知列表中:在此填写姓名 此人是否希望订阅时事通讯?是或否在这里


GCT1015
浏览 113回答 1
1回答

繁星点点滴滴

只需像这样添加一个空格$txt&nbsp;=&nbsp;"This&nbsp;person&nbsp;wishes&nbsp;to&nbsp;be&nbsp;added&nbsp;to&nbsp;the&nbsp;launch&nbsp;day&nbsp;notification&nbsp;list&nbsp;$name<br>Does&nbsp;this&nbsp;person&nbsp;wish&nbsp;to&nbsp;subscribe&nbsp;to&nbsp;the&nbsp;newsletter?&nbsp;$news";如果您不发送 HTML 电子邮件,则应将其替换为<br>类似"\n"$txt&nbsp;=&nbsp;"This&nbsp;person&nbsp;wishes&nbsp;to&nbsp;be&nbsp;added&nbsp;to&nbsp;the&nbsp;launch&nbsp;day&nbsp;notification&nbsp;list&nbsp;$name\nDoes&nbsp;this&nbsp;person&nbsp;wish&nbsp;to&nbsp;subscribe&nbsp;to&nbsp;the&nbsp;newsletter?&nbsp;$news";
随时随地看视频慕课网APP
我要回答