Php简单代码可“保护”内容。
<?php if(isset($_POST['submit'])) { ?>
// protected content \\
<?php } else { ?>
<form action="" method="post">
<button type="submit" name="submit">click to view protected content</button>
</form>
<?php } ?>
现在,当我点击“提交”按钮时,我尝试添加验证码... 但是当我解析验证码时,不要重定向隐藏内容
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<form action="" method="post">
<button class="g-recaptcha" data-sitekey="6LdVvYQUAAAAAIVD_yRB8nBeajeEChQjXhhSldHj" type="submit" name="submit">view protected content</button>
</form>
答案 0 :(得分:0)
我认为您忘了在JS下面添加
<script>
function onSubmit(token) {
document.getElementById("your-form").submit();
}
</script>
请记住将表格更改为
<form action="" method="post" id="your-form">
<button class="g-recaptcha" data-sitekey="6LdVvYQUAAAAAIVD_yRB8nBeajeEChQjXhhSldHj" name="submit" data-callback="onSubmit">view protected content</button>
</form>