思维开阔一点,这个问题也不难
分析http请求头,通过屏幕分辨率和浏览器,操作系统版本可以分辨一部分设备
但这并不绝对准确
------------------------------------------------------AutoCSDN签名档------------------------------------------------------

解决方案 »

  1.   

    一般大网站都是通过User agent来判断属于pc还是移动设备,然后显示不同的界面,像奇艺、谷歌等,你也可以通过这个来禁止非移动终端的访问,这就需要你去收集这些UA,当然即使这样,要完全禁止也是不可能的,在pc端很容易就能伪造UA。
      

  2.   

    https://code.google.com/p/php-mobile-detect/require_once 'Mobile_Detect.php';
    $detect = new Mobile_Detect;
    if (!$detect->isMobile() ) {//如果不是手机上网
       //exit; 或者redrict到404,或者别的处理方法
    }else{
        //你的代码
    }
      

  3.   

    这个只能做到避免PC端访问,而不能做到禁止。因为PC就可以模拟手机。
      

  4.   

    哈哈,怎样模拟都没用,直接禁止访问,下面语句直接识别设备,希望对你有用<script>
              var util = (function(){
                  var u = navigator.userAgent.toLowerCase();
                  return {
                      isIphone : function(){return (RegExp("iphone").test(u) || RegExp("ipod touch").test(u))},
                      isIpad : function(){return RegExp("ipad").test(u)},
                      isAndroid : function(){return (RegExp("android").test(u) || RegExp("android 2").test(u))},
                      isMB : function(){return (util.isIphone() || util.isIpad() || util.isAndroid())}
                  };
              })();
              window.util = util;
              (function(){
                  if( !util.isMB() ){
                      window.location.href = '../index.php';      /**这里改返回你的PC访问端 */
                  }
              })();
        </script>
      

  5.   

    参数可以模拟呀 同样电脑也可以模拟http请求,只有头信息正确也能得到正确的相应
      

  6.   


    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;  
    }  
    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())
    exit;//或跳到其他页
    else
    echo '电脑登录';
      

  7.   

    不可能完全禁止的 curl什么参数都能改...
      

  8.   

    分析$_SERVER['HTTP_USER_AGENT']即可,
    比如我用的
     $phone=0;
     if (str_contains1($_SERVER['HTTP_USER_AGENT'], "phone")||str_contains1($_SERVER['HTTP_USER_AGENT'], "pad")||str_contains1($_SERVER['HTTP_USER_AGENT'], "android"))
     {
     $phone=1; }
      

  9.   

    杀掉script比伪造更容易
    快一年前的旧帖还挖出来~