您的位置:首页 > 编程语言 > PHP开发

做一个php登陆页面,用pc登陆和用手机登陆弹出来的登陆页面不一样。

2014-12-16 21:02 281 查看
<?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;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐