做一个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;

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。