判断用户是安卓还是ios的php代码

来源:互联网 发布:单片机串口通信原理 编辑:程序博客网 时间:2024/06/14 21:07
/**
 * 判断用户是否为安卓还是IOS
 * @author ZTY
 */
function get_device_type()
{
    //全部变成小写字母
    $agent = strtolower($_SERVER['HTTP_USER_AGENT']);
    $type = 'other';
    //分别进行判断
    if(strpos($agent, 'iphone') || strpos($agent, 'ipad'))
   {
      $type = 'ios';
    } 


    if(strpos($agent, 'android'))
   {
      $type = 'android';
    }
    return $type;
}
0 0
原创粉丝点击