Home >Backend Development >PHP Tutorial >php 表单1分钟内用户最多可提交3次,多于3次则10分后才能再次提交,不用数据库

php 表单1分钟内用户最多可提交3次,多于3次则10分后才能再次提交,不用数据库

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-06 20:20:591900browse

cookie或者session都可以,具体点的思路,有具体点的代码更好

回复内容:

cookie或者session都可以,具体点的思路,有具体点的代码更好

我给你代码吧

<code>function check_allow_submit() {
    $now = time();
    if(isset($_SESSION['last_submit_time']) && !empty($_SESSION['last_submit_time'])) {
        if($now-$_SESSION['last_submit_time'] </code>

在请求的处理函数中用$_SESSION[req_time]记录就可以了,请求进入时先进行判断,通过后处理相关任务,处理完毕后$_SESSION[req_time]+1

@kumfo 你的联系方式留个呗

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