资源简介
<?php
function check_wap() {
if (isset($_SERVER['HTTP_VIA'])) return true;
if (isset($_SERVER['HTTP_X_NOKIA_CONNECTION_MODE'])) return true;
if (isset($_SERVER['HTTP_X_UP_CALLING_LINE_ID'])) return true;
if (strpos(strtoupper($_SERVER['HTTP_ACCEPT']),"VND.WAP.WML") > 0) {
// Check whether the browser/gateway says it accepts WML.
$br = "WML";
} else {
$browser = isset($_SERVER['HTTP_USER_AGENT']) ? trim($_SERVER['HTTP_USER_AGENT']) : '';
if(empty($browser)) return true;
$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,$browser) ||
checkSubstrs($mobile_token_list,$browser);
if($found_mobile)
$br ="WML";
else $br = "WWW";
}
if($br == "WML") {
return true;
} else {
return false;
}
}
function check_wap() {
if (isset($_SERVER['HTTP_VIA'])) return true;
if (isset($_SERVER['HTTP_X_NOKIA_CONNECTION_MODE'])) return true;
if (isset($_SERVER['HTTP_X_UP_CALLING_LINE_ID'])) return true;
if (strpos(strtoupper($_SERVER['HTTP_ACCEPT']),"VND.WAP.WML") > 0) {
// Check whether the browser/gateway says it accepts WML.
$br = "WML";
} else {
$browser = isset($_SERVER['HTTP_USER_AGENT']) ? trim($_SERVER['HTTP_USER_AGENT']) : '';
if(empty($browser)) return true;
$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,$browser) ||
checkSubstrs($mobile_token_list,$browser);
if($found_mobile)
$br ="WML";
else $br = "WWW";
}
if($br == "WML") {
return true;
} else {
return false;
}
}
代码片段和文件信息
ta http-equiv=“Content-Type“ content=“text/html; charset=gb2312“>
tle>无标题文档 tle>
// check if wap
function check_wap(){
// 先检查是否为wap代理,准确度高
if(stristr($_SERVER[‘HTTP_VIA‘]“wap“)){
return true;
}
// 检查浏览器是否接受 WML.
elseif(strpos(strtoupper($_SERVER[‘HTTP_ACCEPT‘])“VND.WAP.WML“) > 0){
return true;
}
//检查USER_AGENT
elseif(preg_match(‘/(blackberry|configuration\/cldc|hp |hp-|htc |htc_|htc-|iemobile|kindle|midp|mmp|motorola|mobile|nokia|opera mini|opera |Googlebot-Mobile|YahooSeeker\/M1A1-R2D2|android|iphone|ipod|mobi|palm|palmos|pocket|portalmmm|ppc;|smartphone|sonyericsson|sqh|spv|symbian|
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 8 2015-08-21 13:33 t\aa.html
文件 8 2015-08-21 13:33 t\bb.html
文件 1220 2015-08-21 13:49 t\index.php
目录 0 2015-08-21 14:14 t
文件 1263 2015-08-21 14:16 t\新建 文本文档.txt
----------- --------- ---------- ----- ----
2499 5
相关资源
- php采集类代码(Snoopy)
- 纯原生php实现 WebSocket服务端
- php 获取服务器信息
- php 服务器IP地址查询
- PHP抓包抖音视频内容
- PHP批量加水印代码,支持嵌套文件夹
- php xss问题参数处理
- Thinkphp结合Pjax使用
- PHP版微信自定义分享
- php详细实现精确的获得具体时间您月
- thnkphp5行为扩展html静态缓存
- 仅适用于php5.3:RAR压缩文件转换成Z
- PHP检测本地图片是否有木马
- 教程:CentOs 6.5搭建PHP运行环境和常见
- php链接oracle
- Building restful web services with PHP7
- php面试-MySQL常见问题汇总
- php脚本数据库备份
- Zend Loader.php View.php 相关
- Zend Json.php 相关
-
Zend_Config相关(config.php /config.xm
l/ - Zend/Session/Namespace.php相关,供新手入门
- Zend/Acl.php 以及Zend/Acl/Role.php 相关
- Zend DbTable.php验证以及Sqlite.php 数据库
- Zend/Memory.php 内存管理基础
- Zend/Mime.php相关
- PHP Zend/Log.php 日志记录 相关
- Zend/Search/Lucene.php 相关
- Zend/Feed.php
- 浮动窗口
评论
共有 条评论