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