主攻帝国 全栈为辅

php判断是否在微信支付宝qq浏览器里面

function ddtype_in(){ $useragent=$_SERVER['HTTP_USER_AGENT'];//得到useragent// echo $useragent; if(stripos($useragent,'MicroMessenger')
function ddtype_in(){
    $useragent=$_SERVER['HTTP_USER_AGENT'];//得到useragent
//    echo $useragent;
    if(stripos($useragent,'MicroMessenger')!==false){//先判断是否在微信浏览器里
        return 'weixin';//这个和下面的qq浏览器,不能调换,因为微信手机版也在mqqbrowser这个字符
    }else if(stripos($useragent,'MQQBrowser')!==false){
        return 'qq_mobile';//qq浏览器或手机qq
    }else if(stripos($useragent,'Alipay')!==false){
        return 'alipay';//支付宝里面
    }else if(stripos($useragent,'QQBrowser')){
        return 'qq_pc';//qq浏览器电脑版
    }else{
        return 'qq_mobile';
    }
}

使用方法

ddtype_in();引用即可。