本文整理匯總了PHP中CUrlRewriter::printArray方法的典型用法代碼示例。如果您正苦於以下問題:PHP CUrlRewriter::printArray方法的具體用法?PHP CUrlRewriter::printArray怎麽用?PHP CUrlRewriter::printArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CUrlRewriter
的用法示例。
在下文中一共展示了CUrlRewriter::printArray方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Delete
function Delete($arFilter)
{
global $APPLICATION;
if (!array_key_exists("SITE_ID", $arFilter)) {
$arFilter["SITE_ID"] = SITE_ID;
}
if (array_key_exists("QUERY", $arFilter) && $arFilter["QUERY"] === false) {
$arFilter["QUERY"] = $APPLICATION->GetCurPage();
}
$docRoot = CSite::GetSiteDocRoot($arFilter["SITE_ID"]);
if (!file_exists($docRoot . "/urlrewrite.php")) {
return true;
}
$arUrlRewrite = array();
if (file_exists($docRoot . "/urlrewrite.php")) {
include $docRoot . "/urlrewrite.php";
}
if (!is_array(self::$arRules[$docRoot])) {
self::$arRules[$docRoot] = array();
}
foreach ($arUrlRewrite as $arRule) {
self::$arRules[$docRoot][self::GetKey($arRule)] = $arRule;
}
$bFilterQuery = array_key_exists("QUERY", $arFilter);
$bFilterCondition = array_key_exists("CONDITION", $arFilter);
$bFilterID = array_key_exists("ID", $arFilter);
$bFilterPath = array_key_exists("PATH", $arFilter);
$bFound = false;
foreach (self::$arRules[$docRoot] as $key => $arRule) {
if ($bFilterQuery && !preg_match($arRule["CONDITION"], $arFilter["QUERY"])) {
continue;
}
if ($bFilterCondition && $arRule["CONDITION"] != $arFilter["CONDITION"]) {
continue;
}
if ($bFilterID && ($arFilter["ID"] != "NULL" && $arRule["ID"] != $arFilter["ID"] || $arFilter["ID"] == "NULL" && strlen($arRule["ID"]) <= 0)) {
continue;
}
if ($bFilterPath && $arRule["PATH"] != $arFilter["PATH"]) {
continue;
}
unset(self::$arRules[$docRoot][$key]);
$bFound = true;
}
if ($bFound) {
uasort(self::$arRules[$docRoot], array("CUrlRewriter", "__RecordsCompare"));
if ($f = fopen($docRoot . "/urlrewrite.php", "w")) {
fwrite($f, "<" . "?\n" . CUrlRewriter::printArray(self::$arRules[$docRoot]) . "\n?" . ">");
fclose($f);
bx_accelerator_reset();
return true;
} else {
return false;
}
} else {
return true;
}
}