/**
* 通过授权码获取对应的二维码图片地址
* @param string $code
* @return string image url
*/
public function get_code_image($code=''){
if ($code=='') $code = $this->_logincode;
if (!$code) return false;
return 'http://login.weixin.qq.com/qrcode/'.$this->_logincode.'?t=webwx';
}
/**
* 设置二维码对应的授权码
* @param string $code
* @return class $this
*/
public function set_login_code($code) {
$this->_logincode = $code;
return $this;
}
/**
* 二维码登陆验证
*
* @return status:
* >=400: invaild code; 408: not auth and wait, 400,401: not valid or expired
* 201: just scaned but not confirm
* 200: confirm then you can get user info
*/
public function verify_code() {
if (!$this->_logincode) return false;
$t = time().strval(mt_rand(100,999));
微信扫描二维码登录网站代码示例(2)
内容版权声明:除非注明,否则皆为本站原创文章。
转载注明出处:http://www.heiqu.com/ef2d5a5d7632d3bb121f4f7ccc5c4718.html