$value) { if (stripos(self::getUa(), $value) !== false) { return $value; } } return 'Other'; } /** * 获取OS环境(Ios,Android,Other) */ public static function getOs() { if (self::isIos()) { return 'iOS'; } elseif (self::isAndroid()) { return 'Android'; } else { return 'Other'; } } /** * 是否QQ环境 * @return bool */ public static function isQQ() { return stripos(self::getUa(), ' QQ/') !== false; } /** * 是否微信环境 * @return bool */ public static function isWeiXin() { return stripos(self::getUa(), 'MicroMessenger') !== false; } /** * 是否Android环境 * @return bool */ public static function isAndroid() { return stripos(self::getUa(), 'Android') !== false; } /** * 是否Ios环境 * @return bool */ public static function isIos() { return preg_match("/iPhone|iPad|iPod/i",self::getUa()); } /** * 是否hua wei 手机环境 * @return bool */ public static function isHuaWei() { return preg_match("/build\/huawei|build\/honor|build\/hdh/i", self::getUa()); } }