php版:
<?php
$ua=$_SERVER['HTTP_USER_AGENT'];
$ua=strtolower($ua);
if($ua!="" &&strpos($ua,"baiduspider")){
if(strpos($ua,"android") || strpos($ua,"mobile")){
echo "是百度移动UA";
}else{
echo "是百度PCUA";
}
}else{
echo"不是baiduspider UA";
}
?>