-
-
Save muks999/5edf6e22ba15895cdb5edfc3a2729c34 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