| 123456789101112131415161718192021222324 |
- <?php
- namespace common\helpers;
- class UserAgentHelper
- {
- /**
- * @param null|string $userAgent
- * @return bool
- */
- public static function isIE($userAgent = null)
- {
- if ($userAgent === null) {
- $userAgent = isset($_SERVER['HTTP_USER_AGENT']) ? trim($_SERVER['HTTP_USER_AGENT']) : null;
- }
- if ($userAgent == null) {
- return false;
- }
- if (strpos($userAgent, 'MSIE ') > 0 || strpos($userAgent, 'Trident/') > 0 || strpos($userAgent, 'Edge/') > 0) {
- return true;
- } else {
- return false;
- }
- }
- }
|