if?(strtolower($postObj->MsgType)?==?'text'?&&?trim($postObj->Content)?==?'tuwen1')?{
????$toUser?=?$postObj->FromUserName;
????$fromUser?=?$postObj->ToUserName;
????$arr?=?array(
????????array(
????????????'title'?=>?'niubi',
????????????'description'?=>?'niubihahahahaha',
????????????'picUrl'?=>?'http://www.w3school.com.cn/i/eg_tulip.jpg',
????????????'url'?=>?'http://www.xianlaiwan.cn',
????????),
????);
????$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>";
????echo?sprintf($template,$toUser,$fromUser,time(),'news');
}
2018-09-12