快上网专注成都网站设计 成都网站制作 成都网站建设
成都网站建设公司服务热线:028-86922220

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

phpcookie控制提交频率

         //我要提问基于tp3.2
            public function tiwen(){
                $cityId = parent::$cityId;//区分城市id
                $typeDb=D("FangType");
                $typeData=$typeDb->getConfig(36,$cityId);
                $this->assign("typeData",$typeData);
                if($_POST){
                $db = D("EsfAsk");
                $userid=  $this->userId;
                $asktypeid=I('asktypeid');
                $asktitle=I('asktitle');
                $data['askType'] = $asktypeid;
                $data['askTitle'] = $asktitle;
                $data['description'] =$asktitle;
                $data['askTime'] = time();
                $cookie = cookie('bresfwd');
                cookie('bresfwd',"Y",array('expire'=>60));
                if($cookie){
                      $this->success('提交过于频繁');
                } 
               
                
                $data['cityId']=$cityId;
                $data['userId'] = $userid;
                $data['isAnswer'] = 'N';
                $data = $db->add($data);
                if ($data) {
                    $this->success('提交成功');
                } else {
                    $this->success('提交失败');
                }
             }
                $this->display(); 
            }
js代码: