phpでスマホを判別するサンプル
phpコード:
<?php function devicetype_get(){
$agent = strtolower($_SERVER['HTTP_USER_AGENT’]);
$type = 'other’;
if(strpos($agent, 'iphone’) || strpos($agent, 'ipad’) ){
$type = 'ios’;
}
if(strpos($agent, 'android’)){
$type = 'android’;
}
return $type;
} ?>