setcookie("messtime","yes",time()+60); //第一次成功发起请求后,cookie存入时间,60秒
if ($_COOKIE['messtime']!=""){echo "<script>alert('您已经提交了留言,请在1分钟后再尝试提交');history.go(-1);</script>"; exit;}
执行业务逻辑
PHP限制请求时间
最新推荐文章于 2023-01-19 21:04:48 发布
setcookie("messtime","yes",time()+60); //第一次成功发起请求后,cookie存入时间,60秒
if ($_COOKIE['messtime']!=""){echo "<script>alert('您已经提交了留言,请在1分钟后再尝试提交');history.go(-1);</script>"; exit;}
执行业务逻辑