wxsheng 发表于 2015-8-27 12:30:17

PHP里防止刷新

PHP里防止刷新比较麻烦些,比如对计数器的防止刷新比较麻烦,不象asp里那样方便,但依然可以用比如下面的方法来实现

<?php
session_start();
$allow_sep = "30000";
if (isset($_SESSION["post_sep"]))
{
if (time() - $_SESSION["post_sep"] < $allow_sep)
{
      exit("请不要反复刷新");
}
else
{
   $_SESSION["post_sep"] = time();
}
}
else
{
$_SESSION["post_sep"] = time();
}
?>
页: [1]
查看完整版本: PHP里防止刷新