Space php 形式的字符之间
Space between characters in php form
<?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 与句子的最后一个字符之间有间距。而且,我如何在两个问题之间添加一个中断,以便它们输出如下:
此人希望添加到发布日通知列表中:姓名在此
此人是否希望订阅时事通讯?是或否
只需像这样添加一个space
$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";
<?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 与句子的最后一个字符之间有间距。而且,我如何在两个问题之间添加一个中断,以便它们输出如下:
此人希望添加到发布日通知列表中:姓名在此 此人是否希望订阅时事通讯?是或否
只需像这样添加一个space
$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";