服务器端移动设备检测
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了服务器端移动设备检测相关的知识,希望对你有一定的参考价值。
class Client { /** * Available Mobile Clients * * @var array */ "midp", "240x320", "blackberry", "netfront", "nokia", "panasonic", "portalmmm", "sharp", "sie-", "sonyericsson", "symbian", "windows ce", "benq", "mda", "mot-", "opera mini", "philips", "pocket pc", "sagem", "samsung", "sda", "sgh-", "vodafone", "xda", "iphone", "android" ); /** * Check if client is a mobile client * * @param string $userAgent * @return boolean */ public function isMobileClient($userAgent) { foreach($this->_mobileClients as $mobileClient) { return true; } } return false; } } $client = new Client(); $client->isMobileClient($_SERVER['HTTP_USER_AGENT']);
以上是关于服务器端移动设备检测的主要内容,如果未能解决你的问题,请参考以下文章
Spring Mobile移动端访问后台服务设备类型检测网站偏好及分辨率感知