php实现微信模板消息推送
发布时间:2020-12-12 22:27:22 所属栏目:PHP教程 来源:网络整理
导读:本文实例为大家分享了php微信模板消息推送的具体代码,供大家参考,具体内容如下 1.微信公众号模板消息配置 2.PHP代码 curl_post("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credentialsecret='.$appsecret.'"); $access_token1=json_deco
本文实例为大家分享了php微信模板消息推送的具体代码,供大家参考,具体内容如下 1.微信公众号模板消息配置 2.PHP代码 curl_post("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid='.$appid.'&secret='.$appsecret.'");
$access_token1=json_decode($json_token,true);
$access_token2=$access_token1['access_token'];
setcookie('access_token',$access_token2,7200);
}
//模板消息
$json_template = $this->json_tempalte();
$url="https://api.weixin.qq.com/cgi- bin/message/template/send?access_token=".$access_token2;
$res=$this->curl_post($url,urldecode($json_template));
if ($res['errcode']==0){
return '发送成功';
}else{
return '发送失败';
}
}
/**
/**
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持编程之家。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |