首页 > Web开发 > 详细

防刷功能的实现(thinkphp5)

时间:2020-05-22 19:13:23      阅读:67      评论:0      收藏:0      [点我收藏+]
$seconds = ‘3‘; //时间段[秒]
$refresh = ‘3‘;//最大次数
$cur_time = time();
if(Session::get(‘refresh_times‘)){
    Session::set(‘refresh_times‘,Session::get(‘refresh_times‘)+1);
}else{
    Session::set(‘refresh_times‘,1);
    Session::set(‘last_time‘,$cur_time);
}
if($cur_time - Session::get(‘last_time‘) < $seconds){
    if(Session::get(‘refresh_times‘) >= $refresh){
      //处理工作
    }
}else{
    Session::set(‘refresh_times‘,0);
    Session::set(‘last_time‘,$cur_time);
}

 

防刷功能的实现(thinkphp5)

原文:https://www.cnblogs.com/dongqiliang/p/12938858.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!