13579989107 在线客服 返回顶部
企业动态 行业动态 技术分享

自动识别WAP或WEB客户端浏览器并转入相应页面源码

2014-09-12 22:22:091985

ASP版

以下是代码片段:
<%  
Option Explicit 
dim enterurl 
if instr(Request.ServerVariables("http_accept"),"wap")>0  then 
    enterurl="http://www.xjgqxx.com/wap/index.php"  '网站WAP地址 
     
else 
    enterurl="http://www.xjgqxx.com/"      '网站WEB地址 
     
end if 
Response.Redirect(enterurl) 
%>

 

PHP版本的

 

以下是代码片段:
<?php 

 $iswap =  $_SERVER['HTTP_ACCEPT'];  
if(strpos( $iswap,"wap")>0) 

   header("location:http://www.xjgqxx.com/wap/index.php"); 

else  

   header("location:http://www.xjgqxx.com/");   

?>


关键词:手机网站,电脑网站,自动识别代码

在线咨询
Copyright © 2012-2018 新疆小程序开发,同城小程序saas服务,小程序多端开发,网站建设,微信公众平台开发,新疆新梦想网络科技 版权所有 Power by tianhaiyang.com 陇ICP备19001980号-1