Home >Backend Development >PHP Tutorial >PHP 表单防止刷新交付的方法

PHP 表单防止刷新交付的方法

WBOY
WBOYOriginal
2016-06-13 12:27:13811browse

PHP 表单防止刷新提交的方法

摘自http://bbs.chinaunix.net/thread-667547-1-1.html

---------------------------------------------------------------------

输出表单页面的时候:(举一个例子,并不完善)
$intFlag = md5(time());
$strFlag = 'flag_$intFlag';
$_SESSION["$strFlag"] = 1;


那么接受数据的时候:
$action_flag = trim($_POST["action_flag"]);
if ($action_flag!="" && $_SESSION["$action_flag"]==1)
{
    $_SESSION["$action_flag"] = 2;
    //处理数据
}
else
{
  die("重复提交或者其他错误");
}

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn