php判断是否手机访问

文章描述:

php判断电脑端访问还是手机端访问

//php判断客户端是否为手机  
$agent = $_SERVER['HTTP_USER_AGENT'];  
if (strpos($agent,"NetFront") || strpos($agent,"iPhone") || strpos($agent,"MIDP-2.0") || strpos($agent,"Opera Mini") || strpos($agent,"UCWEB") || strpos($agent,"Android") || strpos($agent,"Windows CE") || strpos($agent,"SymbianOS")){
	echo "mobile";
}else{
	echo "pc";	
}

 

发布时间:2023/04/11

发表评论