' Edge ', ' IE ' = ' msie| iemobile| msiemobile| trident/[.0-9]+ ', ' Chrome ' = ' (?: \ bcrmo\b| crios| Android)?. *chrome/[.0-9]* (Mobile), ' Opera ' = ' opera.*mini| opera.*mobi| android.*opera| Mobile.*opr/[0-9.] +| Coast/[0-9.] + ', ' Firefox ' = ' fennec|firefox.*maemo| (mobile| Tablet). *firefox| Firefox.*mobile ', ' Safari ' = ' version.*mobile.*safari| safari.*mobile| Mobilesafari ', ' ucbrowser ' = ' uc.*browser| ' UCWEB ',//uc Tour ' qqbrowser ' + ' mqqbrowser| Tencenttraveler ',//qq ' the World ' and ' The Worlds ',///The Window viewer ' Maxthon ' = ' Maxthon ', Tour ' Baiduboxapp ' + ' Baiduboxapp ', ' baidubrowser ' = ' baidubrowser ', ' Nokiabrowser ' = ' Nokia ',); /** * Operating System Regular * Note: The system of the mobile device needs to be prioritized * so it needs to be placed in front of the computer system * @var array * @author WUZHC 2016-01-23 */ protected static $platforms = Array ( ' IOS ' = ' \biphone.*mobile|\bipod|\bipad ', ' windows Mobile OS ' = ' windows ce.* (ppc| smartphone| mobile| [0-9] {3}x[0-9]{3}) | Window mobile| Windows Phone [0-9.] +| WCE; ', ' windows Phone OS ' = ' windows Phone 10.0| Windows Phone 8.1| Windows Phone 8.0| Windows Phone os| xblwp7| zunewp7| Windows NT 6. [23]; ARM; ', ' android ' = ' Android ', ' BlackBerry os ' = ' blackberry|\bbb10\b|rim tablet OS ',/ /BlackBerry ' symbianos ' = ' symbian| symbos| series60| series40| syb-[0-9]+|\bs60\b ',//Saipan ' webOS ' = ' webos|hpwos ', ' micromessenger ' + ' Micromessenger ',//' windows ' = ' windows ', ' Windows NT ' = ' Windows NT ', ' Mac OS X ' = ' Mac os X ', ' Ubuntu ' + ' ubuntu ', ' linux ' = ' Linux ', ' Chrome os ' ' = = ' CrOS ',); /** * Version number matching regular (explorer + operating system) * @var Array * @author WUZHC 2016-01-22 */protected static $versionRegexs = Array (//Browser ' Maxthon ' = = ' Maxthon [VER] ',/ /Travel ' Chrome ' + = Array (' Chrome/[ver ', ' crios/[ver] ', ' crmo/[ver] '),//Google ' Firefox ' = ' Fi Refox/[ver] ',////Firefox ' Fennec ' + ' fennec/[ver ',//Firefox ' IE ' = = Array (' iemobile/[ver]; ' , ' Iemobile [ver] ', ' MSIE [ver]; ', ' rv:[ver '), ' opera ' + Array (' opr/[ver] ', ' opera Mini/[ver ', ' Versi On/[ver] ', ' Opera [VER] ', ' uc Browser ' = ' uc Browser[ver] ',//uc ' qqbrowser ' = = Array (' Mqqbro Wser/[ver] ', ' tencenttraveler/[ver] '),//qq ' micromessenger ' = ' micromessenger/[ver] ',//' Baiduboxapp ' = ' baiduboxapp/[ver] ',//Baidu box ' baidubrowser ' = ' baidubrowser/[ver ',//Baidu ' Safari ' = arr Ay (' version/[ver] ', ' safari/[ver] '),//mac OS x browser ' nokiabrowser ' + ' nokiabrowser/[ver] ',//Nokia//O S ' IOS ' = ' \bi? os\b [ver][;] {1} ', ' blackberry ' + = Array (' Blackberry[\w]+/[ver ', ' blackberry.*version/[ver] ', ' version/[ver] '),//BlackBerry ' windows Phone os ' = = Array (' Windows Phone OS [ver] ', ' windows Phone [ver] '), ' windows Phone ' = ' Windows Phone [ver] ', ' Windows NT ' = + ' Windows NT [ver] ', ' windows ' + ' Windows NT [VE R] ', ' symbianos ' = = Array (' symbianos/[ver] ', ' symbian/[ver] '),//Saipan system ' webOS ' = arr Ay (' webos/[ver] ', ' hpwos/[ver '; '),//lg ' Mac OS X ' = ' Mac OS X [VER] ',//Apple system ' BlackBerry OS ' = = Array (' blackberry[\w]+/[ver] ', ' blackberry.*version/[ver] ', ' version/[ver] '), ' android ' = ' Android ' OID [ver] ', ' Chrome OS ' = ' CrOS x86_64 [ver] ',); /** * Get client browser * @param $userAgent $_server[' http_user_agent ') * @param bool $isReTurnVersion//whether to return the version number together * @return String (type + version number) * @author WuZHC 2016-01-23 */public static function Getbrowser ($userAgent, $isReTurnVersion = False) {if (Empty ($userAge NT)) {return '; } $clientBrowser = '; foreach (Array) Self:: $browsers as $key + = $browser) {if (Self::match ($browser, $userAgent)) { $clientBrowser = $key; Break }} if ($isReTurnVersion && $clientBrowser) {$clientBrowser. = '. Self::getversion ($clie Ntbrowser, $userAgent); } return $clientBrowser; }/** * Gets the client operating system * @param $userAgent * @param bool $isReTurnVersion//whether to return the version number together * @return String * @author WUZHC 2016-01-23 */public static function GetPlatform ($userAgent, $isReTurnVersion = False) {if (em Pty ($userAgent)) {return '; } $clientPlatform = '; foreach (Array) Self:: $platforms as $key + = $platform) {if (Self::match ($platform, $userAgent)) { $clientPlatform = $key; Break }} if ($isReTurnVersion && $clientPlatform) {$clientPlatform. = '. Self::getversion ($CL Ientplatform, $userAgent); } return $clientPlatform; /** * Query Version number * @param $propertyName (operating system name and or browser name) * @see self:: $versionRegexs * @param $userAgent * @return String * @author WUZHC 2016-01-22 */public static function GetVersion ($propertyName, $userAgent) { $verRegex = Array_key_exists ($propertyName, Self:: $versionRegexs)? Self:: $versionRegexs [$propertyName]: null; if (! $verRegex) {return '; } else {$verRegex = (array) $verRegex; } $match = Self::matchversion ($verRegex, $userAgent); Start matching if ($match && stripos ($propertyName, ' window ')!== false) {//windown The system version number needs to be converted to the return self: : Getwinversion ($match); } else {return Str_replace (' _', '. ', $match); }}/** * Convert Window System version number according to matching results * @param $match * @return String * @author wuzhc 2016-01-22 */ protected static function Getwinversion ($match) {if ($match = = ' 6.0 ') {return ' Vista '; } else if ($match = = ' 6.1 ') {return ' 7 '; } else if ($match = = ' 6.2 ') {return ' 8 '; } else if ($match = = ' 5.1 ') {return ' XP '; }}/** * Regular match * @param array $regex * @param $userAgent * @return String * @author WUZHC 2016-0 1-22 */protected static function match ($regex, $userAgent) {return (bool) Preg_match (sprintf (' #%s#is ', $regex ), $userAgent, $matches); /** * Version Number matches * @param array $regexs * @param $userAgent * @return String * @author WUZHC 2016-01 -22 */protected static function Matchversion ($regexs, $userAgent) {foreach ((array) $regexs as $regex) { $regex = Str_replace ('[VER] ', ' ([\w\.] +) ', $regex); $match = (bool) preg_match (sprintf (' #%s#is ', $regex), $userAgent, $matches); if ($match) {return $matches [1]; }} "return"; }}