if( strtolower($postObj->MsgType) == 'text' && trim($postObj->Content)=='tuwen2' ){
$toUser = $postObj->FromUserName;
$fromUser = $postObj->ToUserName;
$arr = array(
array(
'title'=>'baidu',
'description'=>"baidu is very cool",
'picUrl'=>'http://pic.baidu.com/65464.png',
'url'=>'http://www.baidu.com',
),
array(
'title'=>'hao123',
'description'=>"hao123 is very cool",
'picUrl'=>'https://www.baidu.com/img/bdlogo.png',
'url'=>'http://www.hao123.com',
),
array(
'title'=>'廖圣平的博客',
'description'=>'廖圣平的博客22',
'picUrl'=>'http://img.mukewang.com/587c69610001b37b06000338-240-135.jpg',

)
);
$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');

//注意:进行多图文发送时,子图文个数不能超过10个
}