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

WBOY
Release: 2016-06-13 12:27:13
Original
751 people have browsed it

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("重复提交或者其他错误");
}

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!