欢迎来到素材无忧网,按 + 收藏我们
登录 注册 退出 找回密码

帝国cms服务器怎么判断终端跳转代码

时间: 2024-02-25 09:55 阅读: 作者:素材无忧网

nginx服务器判断终端跳转代码,一句话就完成了。

if ($http_user_agent ~* (iphone|ipod|android|blackberry)) { rewrite ^ $scheme://www.ebingou.cn$request_uri?; }

当然,apache服务器判断终端跳转代码 也是一句话就搞定了。

RewriteCond %{HTTP_USER_AGENT} “iphone|ipod|android|blackberry” [NC]  RewriteRule ^(.*)$  https://www.ebingou.cn/$1[L,R=302]

以上方法不错,也许并未全部支持。更喜欢在程序上判断朋友可以用下面的代码。

function isMobile() { $mobile = array(); static $mobilebrowser_list ='Mobile|iPhone|Android|WAP|NetFront|JAVA|OperasMini|UCWEB|WindowssCE|Symbian|Series|webOS|SonyEricsson|Sony|BlackBerry|Cellphone|dopod|Nokia|samsung|PalmSource|Xphone|Xda|Smartphone|PIEPlus|MEIZU|MIDP|CLDC'; //note 获取手机浏览器 if(preg_match("/$mobilebrowser_list/i", $_SERVER['HTTP_USER_AGENT'], $mobile)) { return true; }else{ if(preg_match('/(mozilla|chrome|safari|opera|m3gate|winwap|openwave)/i', $_SERVER['HTTP_USER_AGENT'])) { return false; }else{ if($_GET['mobile'] === 'yes') { return true; }else{ return false; } } } }

其他帝国CMS判断多终端跳转的教程集合:
帝国cms服务器判断终端跳转代码
帝国cms判断PC端跳转手机端教程
帝国cms判断手机用户跳转

版权声明: 本站资源均来自互联网或会员发布,如果侵犯了您的权益请与我们联系,我们将在24小时内删除!谢谢!

转载请注明: 帝国cms服务器怎么判断终端跳转代码

标签: 帝国cms  
模板推荐