src/thinkextend/Verify.php
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::destroy();
            //session($key, null);
            return false;
        }

        if ($this->authcode(strtoupper($code)) == $secode['verify_code']) {
            $this->reset && Session::destroy();
            //$this->reset && session($key, null);
            return true;
        }

        return false;
    }
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::destroy();
            //session($key, null);
            return false;
        }

        if ($this->authcode(strtoupper($code)) == $secode['verify_code']) {
            $this->reset && Session::destroy();
            //$this->reset && session($key, null);
            return true;
        }

        return false;
    }
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 :: destroy ( ) ; //session($key, null); return false ; } if ( $ this -> authcode ( strtoupper ( $ code ) ) == $ secode [ 'verify_code' ] ) { $ this -> reset && Session :: destroy ( ) ; //$this->reset && session($key, null); return true ; } return false ; }
验证验证码是否正确
@access public
@param string $code 用户验证码
@param string $id 验证码标识
@return bool 用户验证码是否正确
验证验证码是否正确