if( strtolower( $postObj->MsgType) == 'text'){ if ($postObj->Content =='test'){ $msgType = 'text'; $content ='你输入的为test'; $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, $time, $msgType, $content); echo $info; } }
关注触发事件查看本博客的其它关于微信开发的文章。