标签:linux server aci 浏览器 desire mat agent androi elseif
if(!function_exists(‘get_client_device‘)){
function get_client_device(){
if(request()->isMobile()){
$agent = strtolower($_SERVER[‘HTTP_USER_AGENT‘]);
if(preg_match(‘/iPhone\s([^\s|;]+)/i‘, $agent)) {
return ‘iphone‘;
}elseif(preg_match(‘/SAMSUNG|Galaxy|GT-|SCH-|SM-\s([^\s|;]+)/i‘, $agent)) {
return ‘三星‘;
}elseif(preg_match(‘/HRY-LX1|BLA-L09|VOG-L29|Huawei|Honor|H60-|H30-\s([^\s|;]+)/i‘, $agent)) {
return ‘华为‘;
}elseif(preg_match(‘/M2003J15SC|Redmi|MI CC|M2002J9E|Mi 10|Mi note|MI 9|Mi 8|MI 6|MI 5|MIX 2|MI MAX 2|MIX 3|MI 6|mi one\s([^\s|;]+)/i‘, $agent)) {
return ‘小米‘;
}elseif(preg_match(‘/cp3705A|C3701|cp3648|C106|Coolpad\s([^\s|;]+)/i‘, $agent)) {
return ‘酷派‘;
}elseif(preg_match(‘/ZTE|Z3153|Blade A5|U202AA|Z839\s([^\s|;]+)/i‘, $agent)) {
return ‘中兴‘;
}elseif(preg_match(‘/OPPO|X9007|X907|X909|R831S|R827T|R821T|R811|R2017|PBEM00|PACM00\s([^\s|;]+)/i‘, $agent)) {
return ‘OPPO‘;
}elseif(preg_match(‘/HTC|Desire\s([^\s|;]+)/i‘, $agent)) {
return ‘HTC‘;
}elseif(preg_match(‘/Nubia|NX6|NX5|NX4\s([^\s|;]+)/i‘, $agent)) {
return ‘努比亚‘;
}elseif(preg_match(‘/meizu|MZ|16th|16s\s([^\s|;]+)/i‘, $agent)) {
return ‘魅族‘;
}elseif(preg_match(‘/Gionee|GN\s([^\s|;]+)/i‘, $agent)) {
return ‘金立‘;
}elseif(preg_match(‘/Hisense|HLTE\s([^\s|;]+)/i‘, $agent)) {
return ‘海信‘;
}elseif(preg_match(‘/Lenove\s([^\s|;]+)/i‘, $agent)) {
return ‘联想‘;
}elseif(preg_match(‘/ONEPLUS\s([^\s|;]+)/i‘, $agent)) {
return ‘一加‘;
}elseif(preg_match(‘/vivo Y66L|vivo X9|vivo X9i|V18|V19|V20|vivo\s([^\s|;]+)/i‘, $agent)) {
return ‘vivo‘;
}elseif(preg_match(‘/K-Touch\s([^\s|;]+)/i‘, $agent)) {
return ‘天语‘;
}elseif(preg_match(‘/DOOV\s([^\s|;]+)/i‘, $agent)) {
return ‘朵唯‘;
}elseif(preg_match(‘/GFIVE\s([^\s|;]+)/i‘, $agent)) {
return ‘基伍‘;
}elseif(preg_match(‘/Nokia\s([^\s|;]+)/i‘, $agent)) {
return ‘诺基亚‘;
}else{
return ‘未知机型‘;
}
}else{
return ‘PC‘;
}
}
}
if(!function_exists(‘get_client_brownser‘)){
function get_client_brownser(){
$agent = strtolower($_SERVER[‘HTTP_USER_AGENT‘]);
if (strpos($agent, "msie") !== false || strpos($agent, "trident") !== false) {
return "IE浏览器";
}
if (strpos($agent, "edge") !== false) {
return "Edge浏览器";
}
if (strpos($agent, "360se") !== false) {
return "360浏览器";
}
if (strpos($agent, "micromessenger") !== false) {
return "微信浏览器";
}
if (strpos($agent, "mqqbrowser") !== false) {
return "QQ浏览器";
}
if (strpos($agent, "firefox") !== false) {
return "火狐浏览器";
}
if (strpos($agent, "chrome") !== false) {
return "谷歌浏览器";
}
if (strpos($agent, "safari") !== false) {
return "Safari浏览器";
}
if (strpos($agent, "opera") !== false) {
return "Opera浏览器";
}
if (strpos($agent, "se") !== false&&strpos($agent, "metasr") != false) {
return "搜狗浏览器";
}
if (strpos($agent, "world") !== false) {
return "世界之窗浏览器";
}
if (strpos($agent, "maxthon") !== false) {
return "遨游浏览器";
}
if (strpos($agent, "ucweb") !== false) {
return "UC浏览器";
}
return ‘未知浏览器‘;
}
}
if(!function_exists(‘get_client_os‘)){
function get_client_os(){
$agent = strtolower($_SERVER[‘HTTP_USER_AGENT‘]);
if(strpos($agent, ‘windows nt‘) !== false) {
$platform = ‘windows‘;
} elseif(strpos($agent, ‘macintosh‘) !== false) {
$platform = ‘mac‘;
} elseif(strpos($agent, ‘ipod‘) !== false) {
$platform = ‘ipod‘;
} elseif(strpos($agent, ‘ipad‘) !== false) {
$platform = ‘ipad‘;
} elseif(strpos($agent, ‘iphone‘) !== false) {
$platform = ‘iphone‘;
} elseif (strpos($agent, ‘android‘) !== false) {
$platform = ‘android‘;
} elseif(strpos($agent, ‘unix‘) !== false) {
$platform = ‘unix‘;
} elseif(strpos($agent, ‘linux‘) !== false) {
$platform = ‘linux‘;
} else {
$platform = ‘other‘;
}
return $platform;
}
}
标签:linux server aci 浏览器 desire mat agent androi elseif
原文地址:https://www.cnblogs.com/lina520/p/14188737.html