$accessToken = x;
$open_id = x;
// 判断用户是否关注公众号
$url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token={$accessToken}&openid={$open_id}";
$response = file_get_contents($url);
$userInfo = json_decode($response, true);
if ($userInfo['subscribe'] != 1) {
// 未关注
}