php-判断是否关注微信公众号


<?php

    header("Content-type: text/html; charset=utf-8");

    $access_token = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=XXXX&secret=XXXX";
    $access_msg = json_decode(file_get_contents($access_token));
    $token = $access_msg->access_token;
    $openids = 'xxxx';
    $subscribe_msg = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=$token&openid=$openids";
    $subscribe = json_decode(file_get_contents($subscribe_msg));
    $gzxx = $subscribe->subscribe;

   if($gzxx === 1){
       echo "已关注";
   }else{
       echo "未关注";
   };
?>


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM