微信图文方式返回为什么会出现只有时间的情况?

 case "单图文":

                $content = array();

                $content[] = array('Title'=>'imooc',

                    'Description'=>"imooc is very cool",

                    'PicUrl'=>'http://www.imooc.com/static/img/common/logo.png',

                    'Url'=>'http://www.imooc.com',);

                break;

---------------------------------------------------------

 private function transmitNews($object, $newsArray)

   {

    $toUser = $object->FromUserName;

$fromUser = $object->ToUserName;

//$arr = array($newsArray);

/*

<xml>

<ToUserName><![CDATA[toUser]]></ToUserName>

<FromUserName><![CDATA[fromUser]]></FromUserName>

<CreateTime>12345678</CreateTime>

<MsgType><![CDATA[news]]></MsgType>

<ArticleCount>2</ArticleCount>

<Articles>

<item>

<Title><![CDATA[title1]]></Title> 

<Description><![CDATA[description1]]></Description>

<PicUrl><![CDATA[picurl]]></PicUrl>

<Url><![CDATA[url]]></Url>

</item>

</Articles>

</xml> */

$template = "<xml>

<ToUserName><![CDATA[%s]]></ToUserName>

<FromUserName><![CDATA[%s]]></FromUserName>

<CreateTime>%s</CreateTime>

<MsgType><![CDATA[%s]]></MsgType>

<ArticleCount>1</ArticleCount>

<Articles>";

// foreach($arr as $v)

// {

  $template .="<item>

<Title><![CDATA[".$newsArray['Title']."]]></Title> 

<Description><![CDATA[".$newsArray['Description']."]]></Description>

<PicUrl><![CDATA[".$newsArray['PicUrl']."]]></PicUrl>

<Url><![CDATA[".$newsArray['Url']."]]></Url>

</item>";

// }

  $template .="</Articles>

</xml> ";

// sprintf($template, $toUser, $fromUser, time(), 'news');

echo sprintf($template, $toUser, $fromUser, time(), 'news');


Guard丿星魂
浏览 1286回答 1
1回答

Guard丿星魂

就是这样的
打开App,查看更多内容
随时随地看视频慕课网APP