php教程|php手册
thinkphp代码,代码示例,代码参考,php短信,数据库备份代码,令牌验证,去除代码中的空白和注释智能判断浏览器类型
php教程-php手册
基于移动端的微信和wap网站开发,日益火起来,下面贴一段智能判断分流的代码,希望对菜鸟有所帮助!
function isMobile(){
$useragent = isset($_SERVER[HTTP_USER_AGENT]) ? $_SERVER[HTTP_USER_AGENT] : \;
$useragent_commentsblock = preg_match(|\(.*?\)|,$useragent,$matches) –> 0 ? $matches[0] : \;
function CheckSubstrs($substrs, $text){
foreach ( $substrs as $substr )
if (false !== strpos($text,$substr)) {
return true;
}
return false;
}
$mobile_os_list = array (
Google Wireless Transcoder,
Windows CE,
WindowsCE,
Symbian,
Android,
armv6l,
armv5,
Mobile,
CentOS,
mowser,
AvantGo,
Opera Mobi,
J2ME/MIDP,
Smartphone,
Go.Web,
Palm,
iPAQ
);
$mobile_token_list = array (
Profile/MIDP,
Configuration/CLDC-,
160×160,
176×220,
240×240,
240×320,
320×240,
UP.Browser,
UP.Link,
SymbianOS,
PalmOS,
PocketPC,
SonyEricsson,
Nokia,
BlackBerry,
Vodafone,
BenQ,
Novarra-Vision,
Iris,
NetFront,
HTC_,
Xda_,
SAMSUNG-SGH,
Wapaka,
DoCoMo,
iPhone,
iPod
);
$found_mobile = CheckSubstrs($mobile_os_list,$useragent_commentsblock) || CheckSubstrs($mobile_token_list,$useragent);
if ($found_mobile) {
return true;
} else {
return false;
}
}
if (isMobile()) {
echo 手机登录;
header(“location:http://XXX/wap”); //跳转到移动端网站模块
} else {
echo 电脑登录;
header(“location:http://XXX/”);//
}
票预定网站源码,vscode变量怎么取消,ubuntu关闭当前,tomcat项目命名,SQLITE3教程PDF,京东网站用什么前端框架开发,网络爬虫在什么环境运行,php 变量比较,无锡seo怎么优化,黑客个人网站源码,网页word插件 文档另存,旅游论坛模板lzw
以上是php的代码,如果不管用还可以试试以下JS部分的代码
益智游戏源码下载,ubuntu没有根目录,简单用爬虫软件,平板 php,长沙seo网络lzw
var pc_style = “”
var browser = {
versions: function () {
var u = navigator.userAgent, app = navigator.appVersion;
return {
trident: u.indexOf(Trident) > -1,
presto: u.indexOf(Presto) > -1,
webKit: u.indexOf(AppleWebKit) > -1,
gecko: u.indexOf(Gecko) > -1 && u.indexOf(KHTML) == -1,
mobile: !!u.match(/AppleWebKit.*Mobile.*/) || !!u.match(/AppleWebKit/) && u.indexOf(QIHU) && u.indexOf(Chrome) < 0,
ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),
android: u.indexOf(Android) > -1 || u.indexOf(Linux) > -1,
iPhone: u.indexOf(iPhone) > -1 || u.indexOf(Mac) > -1,
iPad: u.indexOf(iPad) > -1,
webApp: u.indexOf(Safari) == -1,
ua: u
};
}(),
language: (navigator.browserLanguage || navigator.language).toLowerCase()
}
php全景云平台源码,vscode使用教程c,ubuntu下载失败,tomcat 下网站目录,安扎un个sqlite3,网络爬虫与信息提取技术学什么的,php 远程xml,pc和seo排名同步,房地产开发公司网站源代码 墨绿色风格,dedecms 模板文件引入phplzw
if (browser.versions.mobile && !browser.versions.iPad) {
this.location = “/weiweb/192/”; //注意此处要修改成为你自己的微网地址
}
AD:真正免费,域名+虚机+企业邮箱=0元