blic Function Get_Access_Token()
sCode = Request("code")
If sCode ="" And Session("access_token")="" Then
Response.Redirect(GetAuthorization_Code)
Else
If DateDiff("s",Now,Session("access_token_expires"))> 0 Then
Exit Function
End If
End If
Dim url, params,Temp
Url="https://api.weixin.qq.com/sns/oauth2/access_token?"
params = "appid="&s_APPID
params = params & "&secret=" & s_APPSECRET
params = params & "&code=" & sCode
params = params & "&grant_type=authorization_code"
url = Url & params
Temp=RequestUrl(url,"GET","")
‘Die Temp
If CheckData(Temp,"access_token") = True Then
set obj = getjson(Temp)
if isobject(obj) Then
Session("access_token") = obj.access_token
Session("access_token_expires") = DateAdd("s",obj.expires_in,Now)
Session("openid") = obj.openid
End If
set obj = Nothing
Else
Response.Write("Get_Access_Token()=>"&Temp)
Response.End()
End If
End Function
=============================================
互相学习电话微信:18611436777(加微信注明事由)
原文地址:https://www.cnblogs.com/lytocnc/p/9777263.html