如何确认该设备是否为智能手机?

更新于
2026-09-24 18:17:39
2阅读来源:SEO教程
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计105个文字,预计阅读时间需要1分钟。

如何确认该设备是否为智能手机?

php// 判断是否是手机function is_mobile() { $agent=strtolower($_SERVER['HTTP_USER_AGENT']); $is_pc=strpos($agent, 'windows nt') ? true : false; $is_mac=strpos($agent, 'mac os') ? true : false; $is_iphone=strpos($agent, 'iphone') ? true : false;}

如何确认该设备是否为智能手机?

gistfile1.php

//判断是否是手机 function is_mobile() { $agent = strtolower($_SERVER['HTTP_USER_AGENT']); $is_pc = (strpos($agent, 'windows nt')) ? true : false; $is_mac = (strpos($agent, 'mac os')) ? true : false; $is_iphone = (strpos($agent, 'iphone')) ? true : false; $is_android = (strpos($agent, 'android')) ? true : false; $is_ipad = (strpos($agent, 'ipad')) ? true : false; if($is_pc){ return false; } if($is_mac){ return true; } if($is_iphone){ return true; } if($is_android){ return true; } if($is_ipad){ return true; } }

本文共计105个文字,预计阅读时间需要1分钟。

如何确认该设备是否为智能手机?

php// 判断是否是手机function is_mobile() { $agent=strtolower($_SERVER['HTTP_USER_AGENT']); $is_pc=strpos($agent, 'windows nt') ? true : false; $is_mac=strpos($agent, 'mac os') ? true : false; $is_iphone=strpos($agent, 'iphone') ? true : false;}

如何确认该设备是否为智能手机?

gistfile1.php

//判断是否是手机 function is_mobile() { $agent = strtolower($_SERVER['HTTP_USER_AGENT']); $is_pc = (strpos($agent, 'windows nt')) ? true : false; $is_mac = (strpos($agent, 'mac os')) ? true : false; $is_iphone = (strpos($agent, 'iphone')) ? true : false; $is_android = (strpos($agent, 'android')) ? true : false; $is_ipad = (strpos($agent, 'ipad')) ? true : false; if($is_pc){ return false; } if($is_mac){ return true; } if($is_iphone){ return true; } if($is_android){ return true; } if($is_ipad){ return true; } }