前台:
1
后台:
1 public function zxbm() 2 { 3 4 if(IS_POST) 5 { 6 7 8 $verify = new \Think\Verify(); 9 $yzjg = $verify->check($_POST['code']);10 if($yzjg)11 {12 $zxbm = D("zxbm"); // 实例化User对象13 $zxbm->create(); // 生成数据对象14 $res = $zxbm->add(); // 新增用户数据15 16 if($res)17 {18 $data ='在线报名成功!';19 $this->ajaxReturn($data);20 }21 else22 {23 $data ='在线报名失败!';24 $this->ajaxReturn($data);25 }26 }27 else28 {29 $data ='输入的验证码有误!';30 $this->ajaxReturn($data);31 }32 33 34 35 }36 37 38 $this->display();39 40 }41 42 public function verify(){43 $config = array(44 'fontSize' => 45, // 验证码字体大小45 'length' => 4, // 验证码位数46 );47 $Verify = new \Think\Verify($config);48 $Verify->entry();49 50 51 }