本文整理汇总了PHP中Mobile_Detect::match方法的典型用法代码示例。如果您正苦于以下问题:PHP Mobile_Detect::match方法的具体用法?PHP Mobile_Detect::match怎么用?PHP Mobile_Detect::match使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mobile_Detect
的用法示例。
在下文中一共展示了Mobile_Detect::match方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isSmartphone
public function isSmartphone()
{
$detect = new Mobile_Detect();
if ($detect->is("AndroidOS")) {
// AndroidOS の場合 Tab 問わず
return true;
} elseif (parent::isSmartphone()) {
// それ以外の端末の場合 標準の仕様
return true;
} elseif ($detect->match("bingbot|Twitterbot|msnbot")) {
// bing bot の場合 モバイル
return true;
}
return false;
}
示例2: init
//.........这里部分代码省略.........
$this->tpl_customer_id = 0;
$this->tpl_first_buy_date = null;
$this->tpl_carrier = 9;
$this->arrRedownloadProduct = array();
}
$objDb = new SC_Helper_DB_Ex();
if ($objDb->sfColumnExists("cp_dtb_customer_transaction", "id")) {
$where = " customer_id = ? AND transaction_status = ? AND continue_account_id IS NOT NULL AND del_flg = 0";
$arrWhereVal = array($this->tpl_customer_id, 40);
if ($objQuery->exists("cp_dtb_customer_transaction", $where, $arrWhereVal)) {
// OK
} else {
switch (basename(dirname($_SERVER["SCRIPT_NAME"]))) {
case "au":
break;
default:
if ($objCustomer->isLoginSuccess()) {
$objCustomer->EndSession();
SC_Response_Ex::reload();
}
break;
}
}
}
$objCategory = new SC_Helper_Category_Ex();
$this->arrCommonCategory = $objCategory->getList(true);
$this->arrCommonCategoryTree = $objCategory->getTree();
$detect = new Mobile_Detect();
$script_file = $_SERVER["SCRIPT_NAME"];
$script_file = ltrim($script_file, "/");
$script_file2 = str_replace("ios/", "", $script_file);
if ($detect->is("iOS")) {
if (file_exists(HTML_REALDIR . "ios/{$script_file}")) {
SC_Response_Ex::sendRedirect(HTTP_URL . "ios/{$script_file}", $_GET);
}
} elseif (strcmp($script_file, $script_file2) !== 0) {
SC_Response_Ex::sendRedirect(HTTP_URL . "{$script_file2}", $_GET);
}
$_SESSION["is_android"] = $detect->is("AndroidOS");
if ($detect->isMobile() == false) {
// NG
$this->device_support = false;
} elseif ($detect->is("iOS")) {
if ($detect->match("iPhone")) {
// OK
$this->device_support = true;
} elseif ($detect->match("iPod")) {
// NG
$this->device_support = false;
} elseif ($detect->match("iPad")) {
// NG
$this->device_support = false;
} else {
// NG
$this->device_support = false;
}
$version = $detect->version("iOS", $detect::VERSION_TYPE_FLOAT);
if ($version < 6) {
// NG
$this->device_support = false;
}
} elseif ($detect->match("Android") == false) {
// NG
$this->device_support = false;
} elseif (class_exists("SC_DeviceAndroidSelect_Ex", true)) {
$useragent = array();
if (preg_match("|.*; ([^;]+) Build/.*|", $_SERVER["HTTP_USER_AGENT"], $useragent)) {
$device = new SC_DeviceAndroidSelect_Ex(array("search_device_user_agent_word" => $useragent[1], "search_status" => 1));
$this->device_support = $device->exists();
$this->tpl_device = $device->getOne();
}
} elseif ($detect->match("Android")) {
// OK
$this->device_support = true;
} else {
// NG
$this->device_support = false;
}
}
if ($this->device_support) {
GC_Utils_Ex::gfPrintLog("対応端末:" . $_SERVER['HTTP_USER_AGENT']);
return;
} else {
GC_Utils_Ex::gfPrintLog("非対応端末:" . $_SERVER['HTTP_USER_AGENT']);
if (is_a($this, "LC_Page_Index")) {
SC_Response_Ex::sendRedirect(HTTP_URL . "unsupported/index.php");
} elseif (is_a($this, "LC_Page_Unsupported")) {
// 非対応端末表示を行わない
return;
} elseif (is_a($this, "LC_Page_Entry_Kiyaku")) {
// 非対応端末表示を行わない
return;
} elseif ($this->not_unsupported) {
// 非対応端末表示を行わない
return;
} else {
SC_Response_Ex::sendRedirect(HTTP_URL . "unsupported/index.php");
}
}
}