作者 郭文星

111

@@ -98,8 +98,10 @@ class Index extends Api @@ -98,8 +98,10 @@ class Index extends Api
98 $appid = 'wxb7dd0c03865a94e0';//公众号的appid 98 $appid = 'wxb7dd0c03865a94e0';//公众号的appid
99 $secret = '6af75a6fb8211da45631630e34769f82'; 99 $secret = '6af75a6fb8211da45631630e34769f82';
100 // 获取token 100 // 获取token
101 - $token=$this->getAccToken($appid,$secret);  
102 - 101 + $myurl = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" . $appid . "&secret=" . $secret;
  102 + $json_token = http_request($myurl);
  103 + $access_tokens = json_decode($json_token, true);
  104 + $token = $access_tokens['access_token'];
103 //$url = "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/uniform_send?access_token=".$token; 105 //$url = "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/uniform_send?access_token=".$token;
104 $url = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=".$token; 106 $url = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=".$token;
105 107