本文整理汇总了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;
}
}