Created
January 31, 2016 06:07
-
-
Save mono96/61305c5cb8fabf09df2a 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
//スマホ表示分岐 | |
function is_mobile(){ | |
$useragents = array( | |
'iPhone', // iPhone | |
'iPod', // iPod touch | |
'Android.*Mobile', // 1.5+ Android *** Only mobile | |
'Windows.*Phone', // *** Windows Phone | |
'dream', // Pre 1.5 Android | |
'CUPCAKE', // 1.5+ Android | |
'blackberry9500', // Storm | |
'blackberry9530', // Storm | |
'blackberry9520', // Storm v2 | |
'blackberry9550', // Storm v2 | |
'blackberry9800', // Torch | |
'webOS', // Palm Pre Experimental | |
'incognito', // Other iPhone browser | |
'webmate' // Other iPhone browser | |
); | |
$pattern = '/'.implode('|', $useragents).'/i'; | |
return preg_match($pattern, $_SERVER['HTTP_USER_AGENT']); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment