看。这是我的代码,用于从我的数据库中为用户发送电子邮件,这些用户是在ne array中输入的。 在那种情况下你能帮帮我吗?
<?php $servername = "localhost"; $username = "user"; $password = "pass"; $dbname = "dbname"; $conn = new mysqli($servername, $username, $password, $dbname); if ($conn->connect_error) { die("Conexiune esuata: " . $conn->connect_error); } $sql = mysqli_query($conn,"select email from mst_user"); $recipients = array(); while($row = mysqli_fetch_array($sql)) { $recipients[] = $row['email']; } print_r($recipients); $to = implode(" ", $recipients); $subject = htmlspecialchars($_POST["subject"]); $body = $_POST["mesaj"]; $headers = "De la profesor@site.ro" ; mail($to, $subject, $body, $headers); $conn->close(); ?>
答案 0 :(得分:2)
Pair::getRight
上的{p> implode
代替,即:
,