有没有可能的方法添加到下面的脚本,以便它将检测所有触摸屏手机和所有非触摸屏手机?
// 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/');
}发布于 2011-05-23 08:45:08
这并不是PHP的真正问题;)
遗憾的是,没有简单的解决方案,但你可以看看这个:http://wurfl.sourceforge.net/。它是一个用户代理及其属性的数据库。它应该有一个触摸屏在里面的字段。
https://stackoverflow.com/questions/6091801
复制相似问题