<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Request; use Jenssegers\Agent\Facades\Agent; class AgentUtil { public static function getUserAgent() { return Request::header('User-Agent'); } public static function device() { if (self::isMobile()) { return 'mobile'; } return 'pc'; } public static function isWechat() { goto Ov5P1; Ov5P1: static $GP2pD = null; goto hIkNE; hIkNE: if (null === $GP2pD) { $RGqOR = Request::header('User-Agent'); if (strpos($RGqOR, 'MicroMessenger') !== false) { $GP2pD = true; } else { $GP2pD = false; } } goto BOfUK; BOfUK: return $GP2pD; goto GsybB; GsybB: } public static function isMobile() { return Agent::isPhone() || Agent::isTablet(); } public static function isPC() { return !Agent::isPhone() && !Agent::isTablet(); } }