【access_token】获取access_token(Senparc.Weixin.MP.dll)

  1. 不管哪种方法 先导入Senparc.Weixin.MP.dll 官网有详细教程
  2. 第一种方法:
  3. //根据appId判断获取  
  4. if (!AccessTokenContainer.CheckRegistered(appId))//检查是否已经注册  
  5. {  
  6.     AccessTokenContainer.Register(appId, appSecret);//如果没有注册则进行注册  
  7. }  
  8. string access_token = AccessTokenContainer.GetAccessTokenResult(appId).access_token; //获取AccessToken结果  
  9. 第二种方法:
  10. //根据appId、appSecret获取    (一步到位)  
  11. string access_token = AccessTokenContainer.TryGetToken(appId, appSecret);  
  12.  


猜你喜欢

转载自blog.csdn.net/qq_36170585/article/details/68489838