微信模板消息推送

模板消息推送demo

$rs = json_decode(GetToken());
$template_id = ‘模板id’;
$m = M(“Member”);
$touser = openid
a d d r = M ( " O r d e r " ) − > w h e r e ( a r r a y ( ′ i d ′ = > addr = M("Order")->where(array('id'=> addr=M("Order")>where(array(id=>id))->getField(‘address’);
//$touser = $openid;
$data = array(
“first”=>array(
“value”=>"",
“color”=>"#173177"
),
“keyword1”=>array(
“value”=>’’,
“color”=>"#173177"
),
“keyword2”=>array(
“value”=>’’,
“color”=>"#173177"
),
“keyword3”=>array(
“value”=>’’,
“color”=>"#173177"
),
“remark”=>array(
“value”=>"",
“color”=>"#173177"
)
);
c o n t e n t = a r r a y ( " t o u s e r " = > content = array( "touser"=> content=array("touser"=>touser,
“template_id”=> t e m p l a t e i d , " u r l " = > " 跳 转 地 址 " d a t a " = > template_id, "url"=>"跳转地址 "data"=> templateid,"url"=>""data"=>data
);
u r l = ′ h t t p s : / / a p i . w e i x i n . q q . c o m / c g i − b i n / m e s s a g e / t e m p l a t e / s e n d ? a c c e s s t o k e n = ′ . url = 'https://api.weixin.qq.com/cgi-bin/message/template/send?access_token='. url=https://api.weixin.qq.com/cgibin/message/template/send?accesstoken=.access_token;
c o n t e n t = j s o n e n c o d e ( content = json_encode( content=jsonencode(content);
c h = c u r l i n i t ( ) ; c u r l s e t o p t ( ch = curl_init(); curl_setopt( ch=curlinit();curlsetopt(ch, CURLOPT_URL, u r l ) ; c u r l s e t o p t ( url); curl_setopt( url);curlsetopt(ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt( c h , C U R L O P T S S L V E R I F Y P E E R , F A L S E ) ; c u r l s e t o p t ( ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt( ch,CURLOPTSSLVERIFYPEER,FALSE);curlsetopt(ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt( c h , C U R L O P T P O S T , 1 ) ; c u r l s e t o p t ( ch, CURLOPT_POST, 1); curl_setopt( ch,CURLOPTPOST,1);curlsetopt(ch, CURLOPT_POSTFIELDS, $content);
o u t p u t = c u r l e x e c ( output = curl_exec( output=curlexec(ch);
curl_close($ch);
return $output;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值