2011-10-26 110 views
0

因此,我正在爲練習製作一個小郵件表單,無論如何。整個陣列

我要讓再也無法通過電子郵件發送到電子郵件的陣列,

$nomail = array("[email protected]","[email protected]"); 
if($_POST["to"]!=$nomail) 
    mail($_POST["to"],$_POST["subject"],$_POST["message"],$headers); 
else 
    echo "Not Allowed To Email That Email"; 

我如何?

回答

1

改線if($_POST["to"]!=$nomail)if (in_array($_POST['to'], $noemail))

Relevant

1
$nomail = array('[email protected]', '[email protected]'); 

if (!in_array($_POST['to'], $nomail)) { 
    mail($_POST["to"],$_POST["subject"],$_POST["message"],$headers); 
} else { 
    echo 'Not Allowed To Email That Email'; 
}