我的输不出图文消息,而且一直报错:该公众号提供的服务出现故障,请稍后再试
$arr = array(
array(
'title'=>"扫福",
'description'=>"给你发个福字",
'picurl'=>"http://www.imooc.com/static/img/common/logo.png",
'url'=>"https://www.baidu.com",
),
);
$template = "<xml>
<ToUserName><![CDATA[%s]]></ToUserName>
<FromUserName><![CDATA[%s]]></FromUserName>
<CreateTime>%u</CreateTime>
<MsgType><![CDATA[%s]]></MsgType>
<ArticleCount>".count($arr)."</ArticleCount>
<Articles>";
foreach ($arr as $val){
$template .= "<item>
<Title><![CDATA[".$val['title']."]]></Title>
<Description><![CDATA[".$val['description']."]]></Description>
<PicUrl><![CDATA[".$val['picurl']."]]></PicUrl>
<Url><![CDATA[".$val['url']."]]></Url>
</item>";
}
$template .= "</Articles>
</xml>";
$template = trim($template);
$info = sprintf($template,$toUsername,$fromUserName,$time,'news');
echo $info;