php $_SERVER['HTTP_USER_AGENT'] 2
//mobile false pc true no pc
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_linux = (strpos($agent, 'linux')) ? true : false;
$is_unix = (strpos($agent, 'unix')) ? 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_linux){
return false;
}
if($is_unix){
return false;
} */
if($is_iphone){
return true;
}
if($is_android){
return true;
}
if($is_ipad){
return true;
}
}
function infoAgent(){
$agent = strtolower($_SERVER['HTTP_USER_AGENT']);
return $agent;
}
function is_iphone(){
$info = false;
if(strpos(tecrm::infoAgent(), 'iphone')){
$info = "iphone";
}
return $info;
}
function is_android(){
$info = false;
if(strpos(tecrm::infoAgent(), 'android')){
$info = "android";
}
return $info;
}
function is_ipad(){
$info = false;
if(strpos(tecrm::infoAgent(), 'ipad')){
$info = "ipad";
}
return $info;
}
最新文章
- iOS - Push 通知推送
- EF架构~关于多对多关系表无法更新与插入的问题
- javascript数组浅谈2
- C语言 小游戏之贪吃蛇
- linux下查阅文件内容cat,more,less,tail
- centos7 高速安装 mariadb(mysql)
- SQL的JOIN语法解析(inner join, left join, right join, full outer join的区别)
- MongoDB的备份和部署 高级功能索引,聚合复制,分片
- Java基础笔记(1)----语言基础
- Android ADB命令 adb devices 出现error:protocol fault (no status)
- MySQL的SQL语句
- [work]Spring_Jdbc
- 数组初始化 memset fill
- Hibernate入门步骤及概念
- 程序移植到AUTOCAD2013笔记
- 你的跑步姿势正确吗? 教你正确跑步姿势 &; 常识
- 作业 20181030-3互评Alpha版本
- PHP用抛物线的模型实现微信红包生成算法的程序源码
- hdu 3729 I'm Telling the Truth(二分匹配_ 匈牙利算法)
- 【BZOJ 2711】 2711: [Violet 2]After 17 (0-1 背包)
热门文章
- 15 [网络编程]-ssh远程命令
- P2167 [SDOI2009]Bill的挑战
- pycharm如何显示工具栏
- CSS快速入门-定位(position)
- JetBrains全家桶使用攻略
- Linux之linux基础命令2
- tpshop购物网站价格筛选功能的测试用例设计
- php的id加密
- tomcat 在liunx中shutdown后进程仍然存在的两种实用解决办法
- variadic templates &; pass by const reference &; member operator [] in const map &; gcc sucks