PHP判断PC端还是手机端
来源:互联网 发布:性能数据 守望先锋 编辑:程序博客网 时间:2024/05/16 14:04
- <?php
- function isMobile(){
- $useragent=isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
- $useragent_commentsblock=preg_match('|
.∗? |',$useragent,$matches)>0?$matches[0]:''; - function CheckSubstrs($substrs,$text){
- foreach($substrs as $substr){
- if(false!==strpos($text,$substr)){
- return true;
- }else{
- return false;
- }
- }
- }
- $mobile_os_list=array('Google Wireless Transcoder','Windows CE','WindowsCE','Symbian','Android','armv6l','armv5','Mobile','CentOS','mowser','AvantGo','Opera Mobi','J2ME/MIDP','Smartphone','Go.Web','Palm','iPAQ');
- $mobile_token_list=array('Profile/MIDP','Configuration/CLDC-','160×160','176×220','240×240','240×320','320×240','UP.Browser','UP.Link','SymbianOS','PalmOS','PocketPC','SonyEricsson','Nokia','BlackBerry','Vodafone','BenQ','Novarra-Vision','Iris','NetFront','HTC_','Xda_','SAMSUNG-SGH','Wapaka','DoCoMo','iPhone','iPod');
- $found_mobile=CheckSubstrs($mobile_os_list,$useragent_commentsblock) || CheckSubstrs($mobile_token_list,$useragent);
- if ($found_mobile){
- return true;
- }else{
- return false;
- }
- }
- if (isMobile())
- echo 'phone';
- else
- echo 'pc';
- ?>
0 0
- PHP判断PC端还是手机端
- PHP判断PC端还是手机端
- PHP判断PC端还是手机端
- php判断手机端还是pc端
- php判断访问来源是PC还是手机端
- js判断手机端还是pc端
- js判断 手机端还是pc端
- js判断手机端还是PC端
- 判断手机端还是pc端
- js判断手机端还是pc端
- js判断手机端,还是pc端
- js判断手机端还是PC端
- 判断请求PC端还是手机端
- PHP判断是手机端还是PC端 PHP判断是否是微信浏览器
- php 判断手机访问还是pc访问
- php 中判断请求来自 移动手机端,还是来自电脑 PC 端
- php 中判断请求来自 移动手机端,还是来自电脑 PC 端
- PHP判断用户使用手机端登录还是pc端登录(企业版)
- 重新开始
- echar
- Node.js与Sails~redis组件的使用方法
- 360wifi无法启动的原因
- javascript基础(事件对象)(三十一)
- PHP判断PC端还是手机端
- Install Git Extensions on Ubuntu 16.04
- Spring MVC 如何处理 静态资源(如jquery等)
- 手握数据,掌控未来(二)
- 【死磕Java并发】—–深入分析synchronized的实现原理
- 吐步骤的走迷宫
- React Native之携程Moles框架
- 17.2.13错题整理
- 20170214.SLAM相关的资料整理