<?php
// check if wap
function check_wap(){
if(stristr($_SERVER['HTTP_VIA'],"wap")){// 先检查是否为wap代理,准确度高
return true;
}elseif(strpos(strtoupper($_SERVER['HTTP_ACCEPT']),"VND.WAP.WML") > 0){// 检查浏览器是否接受 WML.
return true;
}elseif(preg_match('/(blackberry|configuration\/cldc|hp |hp-|htc |htc_|htc-|iemobile|kindle|midp|mmp|motorola|mobile|nokia|opera mini|opera |Googlebot-Mobile|YahooSeeker\/M1A1-R2D2|android|iphone|ipod|mobi|palm|palmos|pocket|portalmmm|ppc;|smartphone|sonyericsson|sqh|spv|symbian|treo|up.browser|up.link|vodafone|windows ce|xda |xda_)/i', $_SERVER['HTTP_USER_AGENT'])){//检查USER_AGENT
return true;
}else{
return false;
} } if(check_wap()){
echo "手机";
}else{
echo "电脑";
}

最新文章

  1. java单向加密算法小结(1)--Base64算法
  2. 回调函数(callback)
  3. android: SQLite添加数据
  4. NSURLSession学习笔记
  5. 【JavsScript】JavaScript MVC框架PK:Angular、Backbone、CanJS与Ember
  6. 这些年,我收集的JavaScript代码
  7. Apple Pay强势来袭,开发者应做的事情
  8. C++ HttpServlet 高并发多线程 HTTP 服务器(转)
  9. 一周学会Mootools 1.4中文教程:(7)汇总收尾
  10. ROOT android 原理。 基于(zergRush)
  11. thinkphp5.1验证器场景验证中传参的方法。
  12. python实例一
  13. maven使用utf8等
  14. 关于PHP中的全局变量global和$GLOBALS的不同区分
  15. Golang 实现 set 集合,变相实现 切片去重、排序 功能
  16. 【做题】neerc2017的A、C、I、L
  17. Linux 下crontab 详解转
  18. ios开发之--首页 导航栏隐藏 下一级页面显示,pop回来显示白条
  19. python时间格式化及前推
  20. java.lang.IllegalStateException: The specified child already has a parent. You must call removeView

热门文章

  1. 阿里云ECS的使用
  2. IE11中实现颜色渐变
  3. [转]nginx启动期都做了哪些事
  4. 《深入浅出MyBatis技术原理与实战》——7. 插件
  5. Search Insert Position——二分法
  6. spring-web涉及jar包说明
  7. SPOJ - PHRASES K - Relevant Phrases of Annihilation
  8. 六十 数据库访问 使用SQLAlchemy
  9. JDBC连接执行mysql存储过程报权限错误:User does not have access to metadata required to determine stored procedure parameter types. If rights can not be granted,
  10. 初始pip