zoukankan      html  css  js  c++  java
  • 做一个php登陆页面,用pc登陆和用手机登陆弹出来的登陆页面不一样。

    <?php
    header('Content-Type:text/html; charset=UTF-8');//定义页面编码为utf8
    $is_pc = (strpos($agent, 'windows nt')) ? true : false;//是否是pc电脑端
    $is_mobi = (strpos($agent, 'Mobile')) ? true : false;//是否是移动端
    $is_iphone = (strpos($agent, 'iphone')) ? true : false; //是否是iphone
    $is_ipad = (strpos($agent, 'ipad'))?true:false;//是否是ipad
    $is_android = (strpos($agent, 'android')) ? true : false;//是否是安卓
    //自我感觉php的header("Locaion:")跳转页面比html的<meta>跳转要好用,兼容的浏览器多,我曾用<meta>自动跳转页面,浏览器就是不动,最后改成header就好了
    if($is_pc){
    header("Location:dhu_login_pc.php");
    exit;
    //这里跳转到电脑页面,最好先判断
    }if($is_iphone){
    header("Location:dhu_login_mobile.php");//这里跳转到iphone页面
    exit;
    }elseif($is_ipad){
    header("Location:dhu_login_mobile.php");//这里跳转到ipad版页面
    exit;
    }if($is_android){
    header("Location:dhu_login_mobile.php");//这里网址跳转到安卓版页面
    exit;
    }else{
    header("Location:dhu_login_mobile.php")//最后跳转的页面最好设置为低端手机端的页面,或者非html5等耗流量页面,判断到最后,可以知道用了代理或者真的手机非高端

    exit;
    }
    ?>
    另:
    header("Location:dhu_login_pc.php");实现的功能是跳转的dhu_login_pc.php页面,时间间隔0秒,使用它时,前面不能有输出,使用后要紧接着exit;
  • 相关阅读:
    如何突破单库性能瓶颈?
    高性能数据库表该如何设计?
    高性能索引该如何设计?(下)
    高性能索引该如何设计?(上)
    MySQL体系结构与存储引擎
    动态ViewPager导航页面
    ViewPager图片轮转带点的
    手动图片横向轮播
    安卓布局中下拉列表框的实现
    安卓中adapter的应用
  • 原文地址:https://www.cnblogs.com/u0mo5/p/4168039.html
Copyright © 2011-2022 走看看