kha*_*rim 0 php arrays email indices
我有一个简单的mail()脚本,可以通过用逗号分隔电子邮件来动态发送到多个电子邮件.
<?php
$sendto = array("email@gmail.com", "email@zoho.com", "email@mail.usf.edu");
foreach ($sendto as $email)
{
if ($email is the last indice in the array..) // <-- here
$to = $email;
else
$to = $email . ', ';
}
$subject = "test message";
$msg = "this is a test";
if (mail($to, $subject, $msg))
echo "message sent";
else
echo "uh oh";
?>
Run Code Online (Sandbox Code Playgroud)
如何识别(这是我的数组中的最后一块数据)?
| 归档时间: |
|
| 查看次数: |
76 次 |
| 最近记录: |