慕神0356814
2016-08-24 10:44
自定义菜单下 能不能点击后推送多图文信息,能不能给个事例!!!
获取点击后调用这个方法回复多图文啊
public function temp(){
$arr = array(array('title' => 'imooc',
'description'=>'desc',
'picurl'=>'http://mmbiz.qpic.cn/mmbiz_png/h06yWNicL3Vd15sic9u0ba7mxCKYEr57M0zkE3n8HcPLSFqtwJa5n1pUTTkPicK9icFty8U9scNrskReDtJ0nS7s5g/640?wx_fmt=png&tp=webp&wxfrom=5&wx_lazy=1',
'url'=>'http://mp.weixin.qq.com/s?__biz=MzA5MDE3MTc2OA==&mid=2650354371&idx=1&sn=bd8286941d849c11d6a548494c4f9255&scene=18#wechat_redirect'
),array('title' => 'imooc',
'description'=>'desc',
'picurl'=>'http://mmbiz.qpic.cn/mmbiz_png/h06yWNicL3Vd15sic9u0ba7mxCKYEr57M0zkE3n8HcPLSFqtwJa5n1pUTTkPicK9icFty8U9scNrskReDtJ0nS7s5g/640?wx_fmt=png&tp=webp&wxfrom=5&wx_lazy=1',
'url'=>'http://mp.weixin.qq.com/s?__biz=MzA5MDE3MTc2OA==&mid=2650354371&idx=1&sn=bd8286941d849c11d6a548494c4f9255&scene=18#wechat_redirect'
),
array('title' => 'imooc',
'description'=>'desc',
'picurl'=>'http://mmbiz.qpic.cn/mmbiz_png/h06yWNicL3Vd15sic9u0ba7mxCKYEr57M0zkE3n8HcPLSFqtwJa5n1pUTTkPicK9icFty8U9scNrskReDtJ0nS7s5g/640?wx_fmt=png&tp=webp&wxfrom=5&wx_lazy=1',
'url'=>'http://mp.weixin.qq.com/s?__biz=MzA5MDE3MTc2OA==&mid=2650354371&idx=1&sn=bd8286941d849c11d6a548494c4f9255&scene=18#wechat_redirect'
),
);
//多图文时候不能超过10个
$template = "<xml>
<ToUserName><![CDATA[%s]]></ToUserName>
<FromUserName><![CDATA[%s]]></FromUserName>
<CreateTime>%s</CreateTime>
<MsgType><![CDATA[%s]]></MsgType>
<ArticleCount>".count($arr)."</ArticleCount>
<Articles>";
foreach ($arr as $k => $v) {
$template .= "<item>
<Title><![CDATA[".$v['title']."]]></Title>
<Description><![CDATA[".$v['description']."]]></Description>
<PicUrl><![CDATA[".$v['picurl']."]]></PicUrl>
<Url><![CDATA[".$v['url']."]]></Url>
</item>";
}
$template .= "</Articles>
</xml>";
return $template;
}
echo sprintf($template, $toUser, $fromUser, $time, $msgType, $content);
PHP微信公众平台开发高级篇—自定义菜单
28915 学习 · 54 问题
相似问题