用手机上网,手机会发送相关信息,下面是类似PHP代码,java一样
其实就是取不同手机浏览器的HTTP_USER_AGENT
function is_wap(){
$ua = strtolower(@$_SERVER['HTTP_VIA']);
if(stristr($ua,"wap")) return true;
$ua = strtolower(@$_SERVER['HTTP_USER_AGENT']);
$uachar = "/(nokia|sony|ericsson|mot|samsung|sgh|lg|sie-|sec|philips|panasonic|alcatel|lenovo|cldc|midp|mmp|wap|ppc|phone|symbian|ipad|mobile)/i";
if($ua == '' || preg_match($uachar, $ua)) return true;
if (isset($_SERVER['HTTP_ACCEPT']) and (strpos($_SERVER['HTTP_ACCEPT'],'vnd.wap.wml')!==false))
{
return true;
}else{
return false;
}
}