private static String getAccessToken(){ String url = "https://api.weixin.qq.com/cgi-bin/token? grant_type=client_credential&appid="+"wx5d6fccb4d0b05cd8"+"&secret="+"5cba895998cad2b0d0b5895ee43891bd"; String wxJson = new RestTemplate().getForEntity(url, String.class).getBody(); System.out.println("access-token响应: {}"+wxJson); com.alibaba.fastjson.JSONObject jsonObject = JSON.parseObject(wxJson); Object accessTokenObj = jsonObject.get("access_token"); if(accessTokenObj == null){ return null; } String a=accessTokenObj.toString().split(",")[0].split(":")[0]; return a; }
,
请发表评论