顯示回顯後,當您點擊'確定',它只是去顯示什麼都不顯示(所以我結束了一個空白屏幕)的PHP文件,這發生了兩次,我該如何修復它?Php後顯示空白屏幕回顯
在顯示第二個回顯後,當您點擊'ok'時,它必須返回到頁面以便用戶可以執行reCAPTCHA,現在它只進入不顯示任何內容的php文件(所以我最終一個空白屏幕)
<?php
// grab recaptcha library
require_once "recaptchalib.php";
// your secret key
$secret = "secretkey";
// empty response
$response = null;
// check secret key
$reCaptcha = new ReCaptcha($secret);
// if submitted check response
if ($_POST["g-recaptcha-response"]) {
$response = $reCaptcha->verifyResponse(
$_SERVER["REMOTE_ADDR"],
$_POST["g-recaptcha-response"]
);
}
if ($response != null && $response->success) {
if(isset($_POST['submit'])) {
$to = "[email protected]";
$subject = "Voorstel ---.synology.me";
$suggest = $_POST['comment'];
$body = " NL\n Suggestie: $suggest\n";
echo "<script>alert('Je voorstel is verstuurd, wij proberen dit zo snel mogelijk te verwezelijken!');</script>";
//after previous echo is displayed, when you click 'ok', it just goes to the php file which displays nothing (so I end up with a blank screen)
$headers = "From: [email protected]" . "\r\n";
mail($to, $subject, $body, $headers);
} else {
echo "Er ging iets mis, probeer opnieuw of contacteer de administrator op [email protected]!";
}
} else {
echo "<script>alert('Vul de Captcha correct in!');</script>";
//after previous echo is displayed, when you click 'ok', it must go back to the page so the user can do the reCAPTCHA
//now it just goes to the php file which displays nothing (so I end up with a blank screen)
}
?>
不共享你的私鑰公開 –
打開使用error_reporting,看它是否顯示了一個致命的錯誤 – ThisGuyHasTwoThumbs
在你過去的其他語句的頁面加載完成後,你給用戶一個JavaScript警告,在用戶點擊後'確定'肯定沒有發生,因爲頁面完成加載。 – Harrie