用sae开发微信公众号,链接sae里面的mysql总是没反应。
这是代码,
$mysql = new SaeMysql(); //连接到SAE数据库
$mysql->setCharset(GBK);
$sql = "SELECT title, description,picUrl,url FROM news ORDER BY ids LIMIT 0,10 ";
$data = $mysql->getData($sql);
foreach ($data as $row)
{
$itemXml .="<item>
<Title><![CDATA[".$row['title']."]]></Title>
<Description><![CDATA[".$row['description']."]]></Description>
<PicUrl><![CDATA[".$row['picUrl']."]]></PicUrl>
<Url><![CDATA[".$row['url']."]]></Url>
</item>";
}
//
$replay ="<xml>
<ToUserName><![CDATA[%s]]></ToUserName>
<FromUserName><![CDATA[%s]]></FromUserName>
<CreateTime>%s</CreateTime>
<MsgType><![CDATA[news]]></MsgType>
<ArticleCount>%s</ArticleCount>
<Articles>".$itemXml." </Articles>
<FuncFlag>1</FuncFlag>
</xml>";
$RecoGnitionReply = sprintf($replay,$fromUsername,$toUsername,time());
echo $RecoGnitionReply;
在index.php里面测试过,应该是能连得上的,但是公众号上没反应。