微信公众号开发入门---STATE 3:模板推送

 
$openid = XXX;
$template_id = "ti6LHLH0RqF9TGY5HVljwaXZL9_NjY_0M3NqHf1_4Qs";
if ($openid){
$sendData = [
"touser"=>$openid."",
"template_id"=>$template_id,
"url"=>"http://www.xjcode.com",
"data"=>[
"first"=>[
"value"=>"您购买的商品已经被取消",
"color"=>"#173177"
],
"keyword1"=>[
"value"=>$order[‘order_id‘],
"color"=>"#173177"
],
"keyword2"=>[
"value"=>$order[‘cancel_reason‘],
"color"=>"#173177"
],
"keyword3"=>[
"value"=>$order[‘gamename‘],
"color"=>"#173177"
],
"keyword4"=>[
"value"=>$order[‘ordername‘],
"color"=>"#173177"
],
"keyword5"=>[
"value"=>$order[‘buyrole‘],
"color"=>"#173177"
],
"remark"=>[
"value"=>"如有疑问可以直接在公众号内联系客服",
"color"=>"#173177"
],
],
];
$token = AdminWechat::model()->getWxAccessToken();
if ($token){
MongoService::model()->insert(‘weixin_debug‘,[‘error‘=>2]);
$toUrl = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=".$token;
$sendData = json_encode($sendData);
CurlsUtil::post($toUrl,$sendData);
}

微信公众号开发入门---STATE 3:模板推送

上一篇:Java-05-比较equals()与== [转载]


下一篇:微信公众号开发入门---STATE 2:获取用户信息