关注与取消

public function replyGETuser($Wechat,$data)
{
session_start();
$this->logger($str);
switch($data['Event'])
{
case 'subscribe':
{

$openid=$data['FromUserName'];
$appid="wx4dae5d61b7f9935c";
$appSecret="24a91315a1a62a9efe323accf5c93839";
$token=session('token') ;

if($token){

$WechatAuth=new WechatAuth($appid,$appSecret,$token);

}else{
$WechatAuth=new WechatAuth($appid,$appSecret);

$accsseToken=$WechatAuth->getAccessToken();
$token=$accsseToken['access_token'];
session('token',$token);
}
$user=$WechatAuth->userInfo($openid);
$Wechat->replyText("尊敬的"."”".$user['nickname']."“"."欢迎您关注ULIKE微信公众账号!\n".$this->users($Wechat,$data));

}
break;
case 'SCAN':
$Wechat->relayText("尊敬的ULIKE期待您的回来!");
default:
break;
}
}

你可能感兴趣的:(关注与取消)