在php中检测android移动导航器

时间:2014-01-31 08:58:26

标签: php android-browser

我正在尝试制作一个用于检测导航浏览器的二维码的网页,引导您进入应用商店(android,ios,BB ......)

我从之前的项目获得了这个代码,但它不适用于android,所以它适用于ios和BB

//Detect special conditions devices
$iPod = stripos($_SERVER['HTTP_USER_AGENT'],"iPod");
$iPhone = stripos($_SERVER['HTTP_USER_AGENT'],"iPhone");
$iPad = stripos($_SERVER['HTTP_USER_AGENT'],"iPad");
if(stripos($_SERVER['HTTP_USER_AGENT'],"Android") && stripos($_SERVER['HTTP_USER_AGENT'],"mobile")){
    $Android = true;
}else if(stripos($_SERVER['HTTP_USER_AGENT'],"Android")){
    $Android = false;
    $AndroidTablet = true;
}else{
    $Android = false;
    $AndroidTablet = false;
}
$webOS = stripos($_SERVER['HTTP_USER_AGENT'],"webOS");
$BlackBerry = stripos($_SERVER['HTTP_USER_AGENT'],"BlackBerry");
$RimTablet= stripos($_SERVER['HTTP_USER_AGENT'],"RIM Tablet");

我该怎么做才能修复它?此外,在不久的将来,我将不得不添加Windows Phone。我该怎么检查? “资源管理器”?

0 个答案:

没有答案