照着老师的来写关注后还是没回复,哪位同学解决的,麻烦指点一下
// 接收事件推送并回复
public function reponseMsg()
{
$postArr = $GLOBALS['HTTP_RAW_POST_DATA'];
$postObj = simplexml_load_string($postArr);
if (strtolower($postObj->MsgType) == 'event') {
if (strtolower($postObj->Event) == 'subscribe') {
$toUser = $postObj->FromUserName;
$fromUser = $postObj->ToUserName;
$createTime = time();
$msgType = 'text';
$content = '斯是陋室,惟吾德馨';
$template = '<xml><ToUserName><![CDATA[%s]]></ToUserName><FromUserName><![CDATA[%s]]></FromUserName><CreateTime>%s</CreateTime><MsgType><![CDATA[%s]]></MsgType><Content><![CDATA[%s]]></Content></xml>';
$info = sprintf($template,$toUser,$fromUser,$createTime,$msgType,$Content);
echo $info;
}
}
}