org\Verify::check PHP Метод

check() публичный Метод

验证验证码是否正确
public check ( string $code, string $id = '' ) : boolean
$code string 用户验证码
$id string 验证码标识
Результат boolean 用户验证码是否正确
    public function check($code, $id = '')
    {
        $key = $this->authcode($this->seKey) . $id;
        // 验证码不能为空
        $secode = session($key);
        if (empty($code) || empty($secode)) {
            return false;
        }
        // session 过期
        if (time() - $secode['verify_time'] > $this->expire) {
            session($key, null);
            return false;
        }
        if ($this->authcode(strtoupper($code)) == $secode['verify_code']) {
            $this->reset && session($key, null);
            return true;
        }
        return false;
    }