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