Created
October 14, 2013 01:48
-
-
Save jeonghwan-kim/6969552 to your computer and use it in GitHub Desktop.
Detect mobile devices such as iPhone, android phone.
This file contains hidden or 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
<?php | |
//Detect devices | |
$iPod = stripos($_SERVER['HTTP_USER_AGENT'],"iPod"); | |
$iPhone = stripos($_SERVER['HTTP_USER_AGENT'],"iPhone"); | |
$iPad = stripos($_SERVER['HTTP_USER_AGENT'],"iPad"); | |
$Android = stripos($_SERVER['HTTP_USER_AGENT'],"Android"); | |
if ( $Android ) | |
echo 'Android'; | |
else if ( $iPod || $iPhone || $iPad ) | |
echo 'iPhone'; | |
else | |
echo 'Desktop'; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks it works fine