創(chuàng)新互聯(lián)成立與2013年,先為武宣等服務(wù)建站,武宣等地企業(yè),進(jìn)行企業(yè)商務(wù)咨詢服務(wù)。為武宣企業(yè)網(wǎng)站制作PC+手機(jī)+微官網(wǎng)三網(wǎng)同步一站式服務(wù)解決您的所有建站問題。>
<?php function is_mobile(){ //正則表達(dá)式,批配不同手機(jī)瀏覽器UA關(guān)鍵詞。 $regex_match="/(nokia|iphone|android|motorola|^mot-|softbank|foma|docomo|kddi|up.browser|up.link|"; $regex_match.="htc|dopod|blazer|netfront|helio|hosin|huawei|novarra|CoolPad|webos|techfaith|palmsource|"; $regex_match.="blackberry|alcatel|amoi|ktouch|nexian|samsung|^sam-|s[cg]h|^lge|ericsson|philips|sagem|wellcom|bunjalloo|maui|"; $regex_match.="symbian|smartphone|midp|wap|phone|windows ce|iemobile|^spice|^bird|^zte-|longcos|pantech|gionee|^sie-|portalmmm|"; $regex_match.="jigs browser|hiptop|^ucweb|^benq|haier|^lct|operas*mobi|opera*mini|320x320|240x320|176x220"; $regex_match.=")/i"; return isset($_SERVER['HTTP_X_WAP_PROFILE']) or isset($_SERVER['HTTP_PROFILE']) or preg_match($regex_match, strtolower($_SERVER['HTTP_USER_AGENT'])); //如果UA中存在上面的關(guān)鍵詞則返回真。 } if(is_mobile()) { //如果為真,則進(jìn)行WAP頁面。 header( "HTTP/1.1 301 Moved Permanently"); header("Location: http://www.966266.com/wap.php"); }else { //如果為假,則進(jìn)行WEB頁面。 header( "HTTP/1.1 301 Moved Permanently"); header("Location: http://www.966266.com/"); } ?>
網(wǎng)站欄目:php服務(wù)器端檢查手機(jī)訪問還是pc訪問(并跳到不同頁面)-創(chuàng)新互聯(lián)
本文路徑:http://jinyejixie.com/article22/higcc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站設(shè)計(jì)、動(dòng)態(tài)網(wǎng)站、用戶體驗(yàn)、網(wǎng)站策劃、響應(yīng)式網(wǎng)站、ChatGPT
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容