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, 'win...

//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;
    }

目录
相关文章
|
3月前
|
PHP Android开发
android通过http上传文件,服务器端用php写(原创)
android通过http上传文件,服务器端用php写(原创)
44 4
|
3月前
|
应用服务中间件 nginx
百度搜索:蓝易云【HTTP请求是如何关联Nginx server{}块的?】
总结来说,Nginx中的 `server{}`块用于关联HTTP请求和虚拟主机,通过配置不同的 `server{}`块,可以实现多个域名或IP地址的请求分发和处理。这样,Nginx可以根据不同的请求来提供不同的服务和内容。
55 0
|
10月前
|
Unix Go
Golang 语言中怎么拦截系统信号和优雅退出 http server?
Golang 语言中怎么拦截系统信号和优雅退出 http server?
58 0
|
1天前
|
前端开发 PHP 开发者
React Server Component 使用问题之怎么使用Docker运行PHP应用
React Server Component 使用问题之怎么使用Docker运行PHP应用
|
2月前
|
PHP
php 获取带http或https的域名
php 获取带http或https的域名
84 4
|
2月前
|
网络协议 PHP
Swoole 源码分析之 Http Server 模块
想要了解到 `Http Server` 的全貌,其实只要把那张整体的实现图看懂就足以了。但是,如果想要有足够的深度,那么就还需要深入 `Swoole` 的源代码中,就着源码自行分析一遍。同时,也希望这一次的分析,能够给大家带来对 `Swoole` 更多的一些了解。并不要求要深刻的掌握,因为,很多的事情都不可能一蹴而就。从自己的实力出发,勿忘初心。
65 0
Swoole 源码分析之 Http Server 模块
|
2月前
|
小程序
Failed to load local image resource Xx the server responded with a status of of 500 (HTTP/1.1 500)
Failed to load local image resource Xx the server responded with a status of of 500 (HTTP/1.1 500)
|
3月前
|
开发框架 .NET 数据库连接
解决HTTP错误500.19 - internal server error -内部服务器错误的终极指南
解决HTTP错误500.19 - internal server error -内部服务器错误的终极指南
2173 0
|
3月前
|
应用服务中间件 网络安全 nginx
Client sent an HTTP request to an HTTPS server
Client sent an HTTP request to an HTTPS server
378 0
|
11月前
|
PHP Apache
PHP $_SERVER
PHP $_SERVER
29 0

热门文章

最新文章