取消关注的事件是不是可以这样接收呢
//如果是关注 unsubscribe 事件 if( strtolower($postObj->Event == 'unsubscribe') ){ $openid = $postObj->FromUserName; $user['followstate'] = 0; $result = M('Wxuser')->save($user); }
//如果是关注 unsubscribe 事件 if( strtolower($postObj->Event == 'unsubscribe') ){ $openid = $postObj->FromUserName; $user['followstate'] = 0; $result = M('Wxuser')->save($user); }
2017-05-09
public function reponseMsg(){ $postArr = $GLOBALS['HTTP_RAW_POST_DATA']; $postObj = simplexml_load_string( $postArr ); if( strtolower( $postObj->MsgType) == 'event'){ //如果是关注 subscribe 事件 if( strtolower($postObj->Event == 'subscribe') ){ //回复用户消息(纯文本格式) $toUser = $postObj->FromUserName; $fromUser = $postObj->ToUserName; $time = time(); $msgType = 'text'; $content = 'xxxxxxxxxxx'; $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; $this->getwxuserinfo($toUser); } } }
可以像直接把从这里获得的用户OPENID传递到别的方法吗? 这样写总是没有反应
举报