if(strtolower($postObj->MsgType) == 'text'){
if($postObj->Content == '你好'){
$template = "<xml>
<ToUserName><![CDATA[%s]]></ToUserName>
<FromUserName><![CDATA[%s]]></FromUserName>
<CreateTime>%s</CreateTime>
<MsgType><![CDATA[%s]]></MsgType>
<Content><![CDATA[%s]]></Content>
</xml>"
$fromUser = $postObj->ToUserName;
$toUser = $postObj->FromUserName;
$time = time();
$content = "您好,感谢您的关注!";
$msgType = 'text';
$info = sprintf($template,$toUser,$fromUser,$time,$msgType,$content);
echo $info;
}
}
你的</xml>后面没加分号吧