/**
* 判断是否是通过手机访问
* @return bool 是否是移动设备
*/
function isMobile() {
if(isset($_SERVER['HTTP_USER_AGENT'])) {
$userAgent = strtolower($_SERVER['HTTP_USER_AGENT']);
$clientkeywords = array(
'nokia', 'sony', 'ericsson', 'mot', 'samsung', 'htc', 'sgh', 'lg', 'sharp', 'sie-'
,'philips', 'panasonic', 'alcatel', 'lenovo', 'iphone', 'ipod', 'blackberry', 'meizu',
'android', 'netfront', 'symbian', 'ucweb', 'windowsce', 'palm', 'operamini',
'operamobi', 'opera mobi', 'openwave', 'nexusone', 'cldc', 'midp', 'wap', 'mobile'
);
if(preg_match("/(".implode('|',$clientkeywords).")/i",$userAgent)&&strpos($userAgent,'ipad') === false)
{
return true;
}
}
return false;
}