前面已经成功对接微信token
$postStr = $GLOBALS["HTTP_RAW_POST_DATA"]; $xmlObj = simplexml_load_string($postStr,'SimpleXMLElement',LIBXML_NOCDATA); $xmlArr = json_decode(json_encode($xmlObj),true); if($xmlArr['MsgType']=="text"){ if(!empty($xmlArr['Content'])){ if($xmlArr['Content']=="1"){ $reply="aaaaaa"; echo send($reply); } else{ $reply="lalala"; echo send($reply); } } } function send($reply){ global $xmlArr; $str="<xml> <ToUserName><![CDATA[".$xmlArr['FromUserName']."]]></ToUserName> <FromUserName><![CDATA[".$xmlArr['ToUserName']."]]></FromUserName> <CreateTime>".$xmlArr['CreateTime']."</CreateTime> <MsgType><![CDATA[text]]></MsgType> <Content><![CDATA[".$reply."]]></Content> </xml>"; return $str; }
学习了,同求。
你传的时间是重新获取的吗?<CreateTime>".$xmlArr['CreateTime']."</CreateTime>