嗨,我想使用 php 邮件功能发送循环数据,这是我的代码:
foreach ($data['query'] as $row){
echo $row->name;
echo "<br>";
echo $row->time;
echo "<br>";
echo $row->dosage;
echo "<br>";
echo $row->frequency;
echo "<br>";
echo $row->quantity;
echo "<br>";
}
$to = "somebody@example.com";
$subject = "My subject";
$txt = "Hello world!";
$headers = "From: webmaster@example.com";
mail($to,$subject,$txt,$headers);
谁能告诉我如何将 foreach 循环数据附加到电子邮件正文中,我的意思是我想发送循环数据,而不是在正文中发送此文本(Hello World!)。