WordPressでも使われているクラスなので、安心して使える。
ダウンロードはこちらから: https://code.google.com/p/php-mobile-detect/
簡単な使い方:
<?php
require_once './inc/Mobile_Detect.php';
$detect = new Mobile_Detect;
$deviceType = ($detect->isMobile() ? 'mobile' : 'computer');
if( $deviceType == 'mobile' ){
// モバイル用
}else{
// その他用
}
?>
タブレットの識別やiOSの識別なども可能。くわしくは
https://github.com/serbanghita/Mobile-Detect/blob/master/examples/demo.php
など。
随時更新されているので、定期的にチェックしておきたい。
