php判斷終端是手機還是電腦訪問網站代碼_PHP教程

      編輯Tag賺U幣
      教程Tag:暫無Tag,歡迎添加,賺取U幣!

      推薦:實現PHP頁面靜態化
      ?php //首先查看緩存文件if(file_exists(static.html)){//緩存時間為3分鐘if(time()-filemtime(static.html)60*3){//將靜態文件內容返回給客戶端$start_time = microtime();echo 我是從靜態文件中讀取的數據:.br/;echo file_get_contents(static.html);$end_time = mic

      <?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 checkSubstrs($list,$str){ $flag = false; for($i=0;$i<count($list);$i++){ if(strpos($str,$list[$i]) > 0){ $flag = true; break; } } return $flag; } if(check_wap()){ echo "wap"; }else{ echo "web"; } ?>

      分享:怎樣給PHP源代碼加密?PHP二進制加密與解密的解決辦法
      本篇文章小編為大家介紹,怎樣給PHP源代碼加密?PHP二進制加密與解密的解決辦法。需要的朋友參考下

      來源:模板無憂//所屬分類:PHP教程/更新時間:2013-04-23
      相關PHP教程