Created
March 24, 2017 07:38
-
-
Save artikus11/2345b6678169a13fea2a7feebd196759 to your computer and use it in GitHub Desktop.
Функция определения типа устройства
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define("DEV_DEFAULT", 0); | |
define("ANDROID", 1); | |
define("IOS", 2); | |
function getDeviceType(){ | |
$ua = strtolower($_SERVER['HTTP_USER_AGENT']); | |
if(stripos($ua,'android') !== false) { return ANDROID; } | |
if(stripos($ua,'iPhone') !== false) { return IOS;} | |
if(stripos($ua,'iPad') !== false) { return IOS; } | |
return DEV_DEFAULT; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment