• 大小: 1.85KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-01-30
  • 语言: PHP
  • 标签: php  手机  hp  

资源简介

<?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;  
 }  
}

资源截图

代码片段和文件信息




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


评论

共有 条评论