php 限制规定时间内网页刷新次数

180it 2020-02-15 PM 2980℃ 0条

<?php
$min_seconds_between_refreshes = 5;#设置刷新的时间

session_start();

if(array_key_exists('last_access', $_SESSION) && time()-$min_seconds_between_refreshes <= $_SESSION['last_access'])
{
// The user has been here at least $min_seconds_between_refreshes seconds ago - block them

exit('5秒可刷新一次页面.');
}
// Record now as their last access time
$_SESSION['last_access'] = time();
?>

支付宝打赏支付宝打赏 微信打赏微信打赏

如果文章或资源对您有帮助,欢迎打赏作者。一路走来,感谢有您!

标签: none

php 限制规定时间内网页刷新次数