答案 0 :(得分:1)
您在if语句中的逻辑无效。
您需要将代码更改为此。
if (isset($_POST['spamprotection']) && $_POST["spamprotection"] == 'blau') {
$result = ["color" => "green", "msg" => "Ich habe Ihre Mail erhalten und melde mich in Kürze!"];
mail($to, $subject, $message, $header);
if ($file_type) {
$result['msg'] .= "";
}
} else {
$result = ["color" => "red", "msg" => "Nachricht konnte nicht gesendet werden. Bitte senden Sie mir Ihre Anfrage an bm-translations@email.de"];
}
关于平等:
$a = '5'; //This sets $a = 5(string);
$b = 5; //This sets $b = 5(int);
$a == $b; //This checks to see if $a is equal to $b. Will return true.
$a === $b; //This is a strict comparison of $a & $b. It checks to see if $a is equal to $b as well as the type. Meaning $a(string) is equal to $b(int). Will return false.