include_once “wxBizDataCrypt.php”;
appsecret=’**************’;
_GET[“code”];
_GET[“encryptedData”];
_GET[“iv”];
function getUserInfo(sessionKey,iv, data = array();
appid, errCode = encryptedData, data); //decryptData接口这里总是报错不知道啥原因
if ($errCode == 0) {
echo $data;
} else {
echo $errCode;
}
}
function wxUserInfo(appsecret, encryptedData,apiUrl = “https://api.weixin.qq.com/sns/jscode2session?appid={appsecret}&js_code={$code}&grant_type=authorization_code”;
$ch = curl_init();
curl_setopt(apiUrl);
curl_setopt(a = curl_exec(strjson=json_decode(sessionKey = $strjson->session_key;
$userInfo = getUserInfo(sessionKey,iv, userInfo)
{
echo json_encode(array(‘code’=>105, ‘msg’=> “userInfo not”));
}
echo $userInfo; //微信响应的就是一个json数据*/
}
wxUserInfo(appsecret, encryptedData, $iv);