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


PHP CPHPCache::Output方法代碼示例

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


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

示例1: serialize

$cache_id = "blog_last_messages_" . serialize($arParams) . "_" . serialize($UserGroupID) . "_" . $USER->IsAdmin();
if (($tzOffset = CTimeZone::GetOffset()) != 0) {
    $cache_id .= "_" . $tzOffset;
}
if ($arParams["USE_SOCNET"] == "Y") {
    $cache_id .= "_" . $user_id;
}
$cache_path = "/" . SITE_ID . "/blog/last_messages/";
$arResult = array();
if ($arParams["CACHE_TIME"] > 0 && $cache->InitCache($arParams["CACHE_TIME"], $cache_id, $cache_path)) {
    $Vars = $cache->GetVars();
    foreach ($Vars["arResult"] as $k => $v) {
        $arResult[$k] = $v;
    }
    CBitrixComponentTemplate::ApplyCachedData($Vars["templateCachedData"]);
    $cache->Output();
} else {
    if ($arParams["CACHE_TIME"] > 0) {
        $cache->StartDataCache($arParams["CACHE_TIME"], $cache_id, $cache_path);
    }
    $arFilter = array("<=DATE_PUBLISH" => ConvertTimeStamp(time() + $tzOffset, "FULL", false), "PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH, ">PERMS" => BLOG_PERMS_DENY, "BLOG_ACTIVE" => "Y", "BLOG_GROUP_SITE_ID" => SITE_ID);
    if (strlen($arParams["BLOG_URL"]) > 0) {
        $arFilter["BLOG_URL"] = $arParams["BLOG_URL"];
    }
    if (!empty($arParams["GROUP_ID"])) {
        $arFilter["BLOG_GROUP_ID"] = $arParams["GROUP_ID"];
    }
    if ($USER->IsAdmin()) {
        unset($arFilter[">PERMS"]);
    }
    $arSelectedFields = array("ID", "BLOG_ID", "TITLE", "DATE_PUBLISH", "AUTHOR_ID", "DETAIL_TEXT", "BLOG_ACTIVE", "BLOG_URL", "BLOG_GROUP_ID", "BLOG_GROUP_SITE_ID", "AUTHOR_LOGIN", "AUTHOR_NAME", "AUTHOR_LAST_NAME", "AUTHOR_SECOND_NAME", "BLOG_USER_ALIAS", "BLOG_OWNER_ID", "VIEWS", "NUM_COMMENTS", "ATTACH_IMG", "BLOG_SOCNET_GROUP_ID", "CODE", "MICRO");
開發者ID:Satariall,項目名稱:izurit,代碼行數:31,代碼來源:component.php

示例2: unset

         $arFilter["CATEGORY_ID_F"][] = $arCategory["ID"];
     }
 }
 if ($USER->IsAdmin()) {
     unset($arFilter[">PERMS"]);
 }
 if (CModule::IncludeModule("socialnetwork") && IntVal($arParams["SOCNET_GROUP_ID"]) <= 0 && IntVal($arParams["USER_ID"]) <= 0) {
     unset($arFilter[">PERMS"]);
     $cacheSoNet = new CPHPCache();
     $cache_idSoNet = "blog_sonet_" . SITE_ID . "_" . $USER->GetID() . "_extranet";
     $cache_pathSoNet = "/" . SITE_ID . "/blog/sonet/";
     if ($arParams["CACHE_TIME"] > 0 && $cacheSoNet->InitCache($arParams["CACHE_TIME"], $cache_idSoNet, $cache_pathSoNet)) {
         $Vars = $cacheSoNet->GetVars();
         $arAvBlog = $Vars["arAvBlog"];
         CBitrixComponentTemplate::ApplyCachedData($Vars["templateCachedData"]);
         $cacheSoNet->Output();
     } else {
         if ($arParams["CACHE_TIME"] > 0) {
             $cacheSoNet->StartDataCache($arParams["CACHE_TIME"], $cache_idSoNet, $cache_pathSoNet);
         }
         $arUsersInMyGroupsID = CExtranet::GetMyGroupsUsers(SITE_ID);
         $arUsersInMyGroupsID[] = $USER->GetID();
         $arPublicUsersID = CExtranet::GetPublicUsers();
         $arUsersToFilter = array_merge($arUsersInMyGroupsID, $arPublicUsersID);
         $arAvBlog = array();
         $arFilterTmp = array("ACTIVE" => "Y", "GROUP_SITE_ID" => SITE_ID);
         if (IntVal($arParams["GROUP_ID"]) > 0) {
             $arFilterTmp["GROUP_ID"] = $arParams["GROUP_ID"];
         }
         $dbBlog = CBlog::GetList(array(), $arFilterTmp);
         while ($arBlog = $dbBlog->Fetch()) {
開發者ID:mrdeadmouse,項目名稱:u136006,代碼行數:31,代碼來源:component.php


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