0
是否有添加到下面的腳本的可能方式,以便它會檢測所有觸摸屏手機和所有非觸摸屏手機?如何檢測PHP中的所有觸摸和非觸摸屏設備?
// Checks the users device and if a mobile device, it redirects them too the mobile version of our site
$iphone = strpos($_SERVER['HTTP_USER_AGENT'],"iPhone");
$android = strpos($_SERVER['HTTP_USER_AGENT'],"Android");
$palmpre = strpos($_SERVER['HTTP_USER_AGENT'],"webOS");
$berry = strpos($_SERVER['HTTP_USER_AGENT'],"BlackBerry");
$ipod = strpos($_SERVER['HTTP_USER_AGENT'],"iPod");
if ($berry == true)
{
header('Location: http://mobile.example.co/');
}elseif($iphone || $android || $palmpre || $ipod == true){
header('Location: http://touch.example.co/');
}
看看這篇文章:http://www.hand-interactive.com/resources/detect-mobile-php.htm – Johnny 2011-05-23 00:44:41