當前位置: 首頁>>代碼示例>>PHP>>正文


PHP sys::browser方法代碼示例

本文整理匯總了PHP中sys::browser方法的典型用法代碼示例。如果您正苦於以下問題:PHP sys::browser方法的具體用法?PHP sys::browser怎麽用?PHP sys::browser使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在sys的用法示例。


在下文中一共展示了sys::browser方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: browser_detect

function browser_detect()
{
    $agent = "@" . strtolower($_SERVER["HTTP_USER_AGENT"]);
    $version = array();
    sys::$browser = $agent;
    if (strpos($agent, "firefox") and preg_match("|(firefox)/([0-9]+\\.[0-9])|", $agent, $version) or strpos($agent, "opera") and preg_match("|(opera).?([0-9]+\\.[0-9])|", $agent, $version) or strpos($agent, "msie") and preg_match("|(msie) ([0-9]+\\.[0-9])|", $agent, $version) or strpos($agent, "chrome") and preg_match("|(chrome)/([0-9]+)|", $agent, $version) or strpos($agent, "applewebkit") and preg_match("|(applewebkit)/([0-9]+)|", $agent, $version) or strpos($agent, "konqueror") and preg_match("|(konqueror).?([0-9]\\.[0-9])|", $agent, $version) or strpos($agent, "thunderbird") and preg_match("|(thunderbird)/([0-9]+\\.[0-9])|", $agent, $version) or strpos($agent, "miniredir") and preg_match("|(miniredir)/([0-9]\\.[0-9])|", $agent, $version) or strpos($agent, "httpclient") and preg_match("|(httpclient)/([0-9]\\.[0-9])|", $agent, $version) or strpos($agent, "curl") and preg_match("|(curl)/([0-9]+\\.[0-9])|", $agent, $version) or strpos($agent, "apachebench") and preg_match("|(apachebench)/([0-9]\\.[0-9])|", $agent, $version)) {
        sys::$browser = $version[1] . " " . $version[2];
    } else {
        if (strpos($agent, "mozilla") and preg_match("|rv:([0-9]\\.[0-9]).*?gecko|", $agent, $version)) {
            sys::$browser = "mozilla " . $version[1];
        } else {
            if (preg_match("/googlebot|msnbot|yahoo|baidu|teoma/", $agent)) {
                sys::$browser = "search-engine";
            }
        }
    }
    if (strpos($agent, "thunderbird")) {
        $_REQUEST["iframe"] = 1;
    }
    if (strpos($agent, "windows ce")) {
        sys::$browser .= " wince";
    } else {
        if (strpos($agent, "windows")) {
            sys::$browser .= " win";
        } else {
            if (strpos($agent, "macintosh")) {
                sys::$browser .= " mac";
            } else {
                if (strpos($agent, "linux")) {
                    sys::$browser .= "linux";
                }
            }
        }
    }
    if (preg_match("/iphone|nokia/", $agent)) {
        $_REQUEST["tree"] = "minimize";
    }
    if (preg_match("/iphone|nokia|ipad|android/", $agent)) {
        sys::$is_mobile = true;
    }
}
開發者ID:drognisep,項目名稱:Simple-Groupware,代碼行數:41,代碼來源:funcs.php


注:本文中的sys::browser方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。