显示回显后,当您点击'确定',它只是去显示什么都不显示(所以我结束了一个空白屏幕)的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