当前位置: 首页>>代码示例>>PHP>>正文


PHP FileCache::put方法代码示例

本文整理汇总了PHP中FileCache::put方法的典型用法代码示例。如果您正苦于以下问题:PHP FileCache::put方法的具体用法?PHP FileCache::put怎么用?PHP FileCache::put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FileCache的用法示例。


在下文中一共展示了FileCache::put方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: session_login

$data['identity'] = $provider;
if (isset($data['name'])) {
    $data['fullname'] = $data['name'];
}
$user = User::get_by_identity_openidConnectSub($provider, $data['sub']);
if (!$user && $oidc->getPlainOpenid()) {
    // This may be the first time the user logs in after the migration from
    // OpenID 2.0 to OpenID Connect.
    $user = User::get_by_identity($oidc->getPlainOpenid());
    if ($user) {
        $user->identity = null;
        // session_login will overwrite it
    }
}
if ($user) {
    session_login($user, $data);
} else {
    // First time logging in, must claim an existing account or create a new one
    // TODO this duplicates code in revenireOpenid.php
    $user = isset($data['email']) ? User::get_by_email($data['email']) : null;
    $loginType = $user ? 0 : (isset($data['fullname']) ? 1 : (isset($data['nickname']) ? 2 : 3));
    // Store the identity in a temporary file. Don't print it in the form, because then it can be faked on the next page.
    $randString = util_randomCapitalLetterString(20);
    FileCache::put($randString, $data);
    SmartyWrap::assign('page_title', 'Autentificare cu OpenID');
    SmartyWrap::assign('suggestHiddenSearchForm', true);
    SmartyWrap::assign('data', $data);
    SmartyWrap::assign('randString', $randString);
    SmartyWrap::assign('loginType', $loginType);
    SmartyWrap::display('auth/chooseIdentity.ihtml');
}
开发者ID:Jobava,项目名称:mirror-dexonline,代码行数:31,代码来源:revenireOpenidConnect.php

示例2: FileCache

<?php

error_reporting(8191);
require_once 'class/IInterface.php';
require_once 'class/FileCacheAbstract.php';
require_once 'class/FileCache.php';
$expire = 10;
// sec
$cache = new FileCache('/cache');
// only as example do not set dir in real life!
if ($content = $cache->get('main')) {
    echo 'This Page from cache for ' . $cache->getRemainigCacheTimeByKey('main') . ' sec!<br>';
    echo $content;
    exit;
}
$cache->startCaching();
$param = 'This is main page';
echo '<h1>Main Page</h1>';
echo '<p>' . $param . '</p>';
$cache->put('main', $cache->getCacheContent(), $expire);
header('Content-Type: text/html; charset=utf-8');
$cache->stopAndShowCaching();
exit;
开发者ID:nedzelskiy,项目名称:job-interview,代码行数:23,代码来源:index.php


注:本文中的FileCache::put方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。