照着视频写的,为什么我的单文本回复消息成功不了?
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;
}
}