你能帮我解决这个问题吗?我想一次返回所有收集的电子邮件地址。这是代码。添加评论。
function send_notification($ML_today) {
// Getting expired contents from the database through a function
$ML_send_to = check_expired($ML_today);
if(count($ML_send_to) != 0){
foreach ($ML_send_to as $ML_user_id) {
$ML_query_email = mysql_query("SELECT `email` FROM `users` WHERE `userID` = '$ML_user_id'");
$ML_row_3 = mysql_fetch_array($ML_query_email);
$ML_email = $ML_row_3[0];
$ML_to = $ML_email;
$ML_subject = 'Library notification';
$ML_message = 'You have an expired library book to be returned. Please check your reservations.';
$ML_headers = 'From: libray@example.com' . "\r\n" .
'Reply-To: libraryr@example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($ML_to, $ML_subject, $ML_message, $ML_headers);
// Here I want to collect all the email addresss I sent emails and return once
$ML_sent_all = // Stucked here
}
// Rerturning Emails
return 'Message sent to: ' . $ML_sent_all;
}
}