判断是否为微信客户端访问

/**
 * 判断是否为微信客户端访问
 * @return boolean
 */
function is_wechat_client() {
    $useragent = addslashes($_SERVER['HTTP_USER_AGENT']);
    if (strpos($useragent, 'MicroMessenger') === false && strpos($useragent, 'Windows Phone') === false) {
        return false;
    }
    return true;
}


Yii2、PHP高手交流群 》上海-无可取代<13717338908>分享