PHP中QQ登录报client request's parameters are invalid, invalid openid错误

PHP中QQ登录报client request's parameters are invalid, invalid openid错误解决方法:

Thinkphp中报错时的代码:

Vendor('QQapi.qqConnectAPI');
$qc = new \QC();
$access_token= $qc->qq_callback();
$openid= $qc->get_openid();
$arr = $qc->get_user_info();

报错信息:

error:
-1
msg :
client request's parameters are invalid, invalid openid

解决方法:

重新获取$qc = new \QC($access_token,$openid);QC对象  

Vendor('QQapi.qqConnectAPI');
$qc = new \QC();
$access_token= $qc->qq_callback();
$openid= $qc->get_openid();
$qc = new \QC($access_token,$openid);
$arr = $qc->get_user_info();

dump($arr);

获取结果:

array(21) {
["ret"] => int(0)
["msg"] => string(0) ""
["is_lost"] => int(0)
["nickname"] => string(18) "六月初小程序"
["gender"] => string(3) "男"
["province"] => string(0) ""
["city"] => string(0) ""
["year"] => string(1) "0"
["constellation"] => string(0) ""
["figureurl"] => string(73) "http://qzapp.qlogo.cn/qzapp/101570402/2B369E0DA5747764359F92833D0BE87C/30"
["figureurl_1"] => string(73) "http://qzapp.qlogo.cn/qzapp/101570402/2B369E0DA5747764359F92833D0BE87C/50"
["figureurl_2"] => string(74) "http://qzapp.qlogo.cn/qzapp/101570402/2B369E0DA5747764359F92833D0BE87C/100"
["figureurl_qq_1"] => string(63) "http://thirdqq.qlogo.cn/g?b=oidb&k=Qr3OOcQzicbU8JWWGr0vpuw&s=40"
["figureurl_qq_2"] => string(64) "http://thirdqq.qlogo.cn/g?b=oidb&k=Qr3OOcQzicbU8JWWGr0vpuw&s=100"
["figureurl_qq"] => string(64) "http://thirdqq.qlogo.cn/g?b=oidb&k=Qr3OOcQzicbU8JWWGr0vpuw&s=100"
["figureurl_type"] => string(1) "0"
["is_yellow_vip"] => string(1) "0"
["vip"] => string(1) "0"
["yellow_vip_level"] => string(1) "0"
["level"] => string(1) "0"
["is_yellow_year_vip"] => string(1) "0"
}

至此已经正确获取到了用户信息!

六月初字帖坊小程序 你想要的字帖模板及工具,这里都有!