thinkphp3.2.1验证码2次验证

$verify = new \Think\Verify();
global $seKey;
$seKey = $verify->seKey;
function authcode($str){
$key = substr(md5($GLOBALS['seKey']), 5, 8);
$str = substr(md5($str), 8, 10);
return md5($key . $str);
}
function check($code, $id = '') {
$key = authcode($GLOBALS['seKey']).$id;
// 验证码不能为空
$secode = session($key);
if(empty($code) || empty($secode)) {
return false;
}
if(authcode(strtoupper($code)) == $secode['verify_code']) {
return true;
}
return false;
}
if (check(I('verify'))) {
$this->success('验证码正确', $_SERVER['HTTP_REFERER']);
} else {
$this->error('验证码错误', $_SERVER['HTTP_REFERER']);
}

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注