国产xxxx99真实实拍_久久不雅视频_高清韩国a级特黄毛片_嗯老师别我我受不了了小说

資訊專欄INFORMATION COLUMN

總有一些不經(jīng)意的時光,需要被鐫刻.

tracy / 790人閱讀

摘要:我們使用的來獲取手機用戶瀏覽器的用戶代理,然后匹配已有的各種手機瀏覽器代理庫,如果含有匹配的關(guān)鍵字,則判斷為手機移動終端用戶。使用時只需調(diào)用函數(shù)。如以下代碼表示,當匹配用戶為手機訪問時,頁面跳轉(zhuǎn)到網(wǎng)站手機版

我們使用PHP的$_SERVER["HTTP_USER_AGENT"]來獲取手機用戶瀏覽器的用戶代理,然后匹配已有的各種手機瀏覽器代理庫,如果含有匹配的關(guān)鍵字,則判斷為手機(移動終端)用戶。

function is_mobile() {
$user_agent = $SERVER["HTTP_USER_AGENT"];
$mobile_agents = array("240x320","acer","acoon","acs-","abacho","ahong","airness","alcatel",
"amoi","android","anywhereyougo.com","applewebkit/525","applewebkit/532","asus","audio",
"au-mic","avantogo","becker","benq","bilbo","bird","blackberry","blazer","bleu",
"cdm-","compal","coolpad","danger","dbtel","dopod","elaine","eric","etouch","fly ",
"fly
","fly-","go.web","goodaccess","gradiente","grundig","haier","hedy","hitachi",
"htc","huawei","hutchison","inno","ipad","ipaq","iphone","ipod","jbrowser","kddi",
"kgt","kwc","lenovo","lg ","lg2","lg3","lg4","lg5","lg7","lg8","lg9",
"lg-","lge-","lge9","longcos","maemo",
"mercator","meridian","micromax","midp","mini","mitsu","mmm","mmp","mobi","mot-",
"moto","nec-","netfront","newgen","nexian","nf-browser","nintendo","nitro","nokia",
"nook","novarra","obigo","palm","panasonic","pantech","philips","phone","pg-",
"playstation","pocket","pt-","qc-","qtek","rover","sagem","sama","samu","sanyo",
"samsung","sch-","scooter","sec-","sendo","sgh-","sharp","siemens","sie-","softbank",
"sony","spice","sprint","spv","symbian","tablet","talkabout","tcl-","teleca","telit",
"tianyu","tim-","toshiba","tsm","up.browser","utec","utstar","verykool","virgin",
"vk-","voda","voxtel","vx","wap","wellco","wig browser","wii","windows ce",
"wireless","xda","xde","zte");
$is_mobile = false;
foreach ($mobile_agents as $device) {
if (stristr($user_agent, $device)) {
$is_mobile = true;
break;
}
}
return $is_mobile;
}
上述代碼中函數(shù)is_mobile()來判斷用戶終端類型,將收集到的當今各種手機的HTTP_USER_AGENT歸結(jié)到數(shù)組$mobile_agents中,并進行匹配。使用時只需調(diào)用函數(shù)is_mobile()。如以下代碼表示,當匹配用戶為手機訪問時,頁面跳轉(zhuǎn)到網(wǎng)站手機版

文章版權(quán)歸作者所有,未經(jīng)允許請勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。

轉(zhuǎn)載請注明本文地址:http://specialneedsforspecialkids.com/yun/20655.html

相關(guān)文章

  • js閉包本質(zhì)

    摘要:也正因為這個閉包的特性,閉包函數(shù)可以讓父函數(shù)的數(shù)據(jù)一直駐留在內(nèi)存中保存,從而這也是后來模塊化的基礎(chǔ)。只有閉包函數(shù),可以讓它的父函數(shù)作用域永恒,像全局作用域,一直在內(nèi)存中存在。的本質(zhì)就是如此,每個模塊文件就是一個大閉包。 為什么會有閉包 js之所以會有閉包,是因為js不同于其他規(guī)范的語言,js允許一個函數(shù)中再嵌套子函數(shù),正是因為這種允許函數(shù)嵌套,導致js出現(xiàn)了所謂閉包。 function...

    qianfeng 評論0 收藏0
  • 別讓任何人打亂你節(jié)奏

    摘要:人生中的每一件事都取決于我們自己的時間,你身邊有些朋友也許遙遙領(lǐng)先于你,有些朋友也許落后于你,但凡事都有它自己的節(jié)奏因此,無論當下如何,保持一顆平靜的心,從容對待。愿你始終相信,一切都會準時到來的。不言而喻的是信心對完成任務的作用很大。 《別讓任何人打亂你的生活節(jié)奏》完美人生 就是 18歲成人 22歲大學畢業(yè),25歲工作穩(wěn)定,30歲之前買房結(jié)婚生子,35歲之后人生軌跡就會定型…… 可是...

    fanux 評論0 收藏0
  • 程序員畫像,十年沉浮

    摘要:十年,轉(zhuǎn)瞬即逝,人生進入下半場。沒想到,公司在短短年時間里就上市了,作為頭部員工,他獲得了不菲的回報。他其實挺喜歡寫代碼的,但程序員工資還是低了點。就像養(yǎng)狗一樣,要有規(guī)矩。去年為了還貸款,還變賣了一套。 風險預警。本文屬于毒雞湯系列,經(jīng)過文學渲染,讀后或產(chǎn)生焦慮,有相關(guān)抵制者慎入。 十年,轉(zhuǎn)瞬即逝,人生進入下半場。眾生皆苦,萬相本無。且看風云變幻,慢品苦辣酸甜。小姐姐味道微信公眾號首發(fā)。 ...

    stdying 評論0 收藏0
  • 苦逼程序員10年

    摘要:沒想到,公司在短短年時間里就上市了,作為頭部員工,他獲得了不菲的回報。他其實挺喜歡寫代碼的,但程序員工資還是低了點。小馮對自己的定位直言不諱。在這過程中,他選了幾個比較好的城市,都購置了房產(chǎn)。去年為了還貸款,還變賣了一套。 風險預警。本文屬于毒雞湯系列,經(jīng)過文學渲染,讀后或產(chǎn)生焦慮,有相關(guān)抵制者慎入。 十年,轉(zhuǎn)瞬即逝,人生進入下半場。眾生皆苦,萬相本無。且看風云變幻,慢品苦辣酸甜。小姐...

    cartoon 評論0 收藏0
  • 苦逼程序員10年

    摘要:沒想到,公司在短短年時間里就上市了,作為頭部員工,他獲得了不菲的回報。他其實挺喜歡寫代碼的,但程序員工資還是低了點。小馮對自己的定位直言不諱。在這過程中,他選了幾個比較好的城市,都購置了房產(chǎn)。去年為了還貸款,還變賣了一套。 風險預警。本文屬于毒雞湯系列,經(jīng)過文學渲染,讀后或產(chǎn)生焦慮,有相關(guān)抵制者慎入。 十年,轉(zhuǎn)瞬即逝,人生進入下半場。眾生皆苦,萬相本無。且看風云變幻,慢品苦辣酸甜。小姐...

    imccl 評論0 收藏0

發(fā)表評論

0條評論

最新活動
閱讀需要支付1元查看
<