這篇文章主要介紹“PHP怎么判斷當(dāng)前使用的瀏覽器類型”,在日常操作中,相信很多人在PHP怎么判斷當(dāng)前使用的瀏覽器類型問(wèn)題上存在疑惑,小編查閱了各式資料,整理出簡(jiǎn)單好用的操作方法,希望對(duì)大家解答”PHP怎么判斷當(dāng)前使用的瀏覽器類型”的疑惑有所幫助!接下來(lái),請(qǐng)跟著小編一起來(lái)學(xué)習(xí)吧!
為仁和等地區(qū)用戶提供了全套網(wǎng)頁(yè)設(shè)計(jì)制作服務(wù),及仁和網(wǎng)站建設(shè)行業(yè)解決方案。主營(yíng)業(yè)務(wù)為成都做網(wǎng)站、網(wǎng)站設(shè)計(jì)、仁和網(wǎng)站設(shè)計(jì),以傳統(tǒng)方式定制建設(shè)網(wǎng)站,并提供域名空間備案等一條龍服務(wù),秉承以專業(yè)、用心的態(tài)度為用戶提供真誠(chéng)的服務(wù)。我們深信只要達(dá)到每一位用戶的要求,就會(huì)得到認(rèn)可,從而選擇與我們長(zhǎng)期合作。這樣,我們也可以走得更遠(yuǎn)!判斷瀏覽器類型方法
function userBrowser() { $user_OSagent = $_SERVER['HTTP_USER_AGENT']; if (strpos($user_OSagent, "Maxthon") && strpos($user_OSagent, "MSIE")) { $visitor_browser = "Maxthon(Microsoft IE)"; } elseif (strpos($user_OSagent, "Maxthon 2.0")) { $visitor_browser = "Maxthon 2.0"; } elseif (strpos($user_OSagent, "Maxthon")) { $visitor_browser = "Maxthon"; } elseif (strpos($user_OSagent, "MSIE 9.0")) { $visitor_browser = "MSIE 9.0"; } elseif (strpos($user_OSagent, "MSIE 8.0")) { $visitor_browser = "MSIE 8.0"; } elseif (strpos($user_OSagent, "MSIE 7.0")) { $visitor_browser = "MSIE 7.0"; } elseif (strpos($user_OSagent, "MSIE 6.0")) { $visitor_browser = "MSIE 6.0"; } elseif (strpos($user_OSagent, "MSIE 5.5")) { $visitor_browser = "MSIE 5.5"; } elseif (strpos($user_OSagent, "MSIE 5.0")) { $visitor_browser = "MSIE 5.0"; } elseif (strpos($user_OSagent, "MSIE 4.01")) { $visitor_browser = "MSIE 4.01"; } elseif (strpos($user_OSagent, "MSIE")) { $visitor_browser = "MSIE 較高版本"; } elseif (strpos($user_OSagent, "NetCaptor")) { $visitor_browser = "NetCaptor"; } elseif (strpos($user_OSagent, "Netscape")) { $visitor_browser = "Netscape"; } elseif (strpos($user_OSagent, "Chrome")) { $visitor_browser = "Chrome"; } elseif (strpos($user_OSagent, "Lynx")) { $visitor_browser = "Lynx"; } elseif (strpos($user_OSagent, "Opera")) { $visitor_browser = "Opera"; } elseif (strpos($user_OSagent, "Konqueror")) { $visitor_browser = "Konqueror"; } elseif (strpos($user_OSagent, "Mozilla/5.0")) { $visitor_browser = "Mozilla"; } elseif (strpos($user_OSagent, "Firefox")) { $visitor_browser = "Firefox"; } elseif (strpos($user_OSagent, "U")) { $visitor_browser = "Firefox"; } else { $visitor_browser = "其它"; } return $visitor_browser; }
直接調(diào)用 userBrowser()
到此,關(guān)于“PHP怎么判斷當(dāng)前使用的瀏覽器類型”的學(xué)習(xí)就結(jié)束了,希望能夠解決大家的疑惑。理論與實(shí)踐的搭配能更好的幫助大家學(xué)習(xí),快去試試吧!若想繼續(xù)學(xué)習(xí)更多相關(guān)知識(shí),請(qǐng)繼續(xù)關(guān)注創(chuàng)新互聯(lián)-成都網(wǎng)站建設(shè)公司網(wǎng)站,小編會(huì)繼續(xù)努力為大家?guī)?lái)更多實(shí)用的文章!