本文整理汇总了PHP中cache_load函数的典型用法代码示例。如果您正苦于以下问题:PHP cache_load函数的具体用法?PHP cache_load怎么用?PHP cache_load使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cache_load函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fans_search
function fans_search($user, $fields = array())
{
global $_W;
$struct = cache_load('fansfields');
if (empty($fields)) {
$select = '*';
} else {
foreach ($fields as $field) {
if (!in_array($field, $struct)) {
unset($fields[$field]);
}
}
$select = '`from_user`, `' . implode('`,`', $fields) . '`';
}
$result = pdo_fetchall("SELECT {$select} FROM " . tablename('fans') . " WHERE from_user IN ('" . implode("','", is_array($user) ? $user : array($user)) . "')", array(), 'from_user');
if (!empty($result)) {
foreach ($result as &$row) {
if (!empty($row['avatar'])) {
if (strexists($row['avatar'], 'avatar_')) {
$row['avatar'] = $_W['siteroot'] . 'resource/image/avatar/' . $row['avatar'];
} elseif (strexists($row['avatar'], 'http')) {
} else {
$row['avatar'] = $_W['attachurl'] . $row['avatar'];
}
}
}
if (is_array($user)) {
return $result;
} else {
return $result[$user];
}
} else {
return array();
}
}
示例2: getCardTicket
public function getCardTicket()
{
$cachekey = "cardticket:{$this->account['acid']}";
$cache = cache_load($cachekey);
if (!empty($cache) && !empty($cache['ticket']) && $cache['expire'] > TIMESTAMP) {
$this->account['card_ticket'] = $cache;
return $cache['token'];
}
load()->func('communication');
$access_token = $this->getAccessToken();
if (is_error($access_token)) {
return $access_token;
}
$url = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token={$access_token}&type=wx_card";
$content = ihttp_get($url);
if (is_error($content)) {
return error(-1, '调用接口获取微信公众号 card_ticket 失败, 错误信息: ' . $content['message']);
}
$result = @json_decode($content['content'], true);
if (empty($result) || intval($result['errcode']) != 0 || $result['errmsg'] != 'ok') {
return error(-1, '获取微信公众号 card_ticket 结果错误, 错误信息: ' . $result['errmsg']);
}
$record = array();
$record['ticket'] = $result['ticket'];
$record['expire'] = TIMESTAMP + $result['expires_in'] - 200;
$this->account['card_ticket'] = $record;
cache_write($cachekey, $record);
return $record['ticket'];
}
示例3: getAccessToken
private function getAccessToken()
{
global $_W, $_GPC;
load()->func('cache');
$api = cache_load("ewei.money.api_share.json::" . $_W['uniacid'], true);
$new = false;
if (empty($api['appid']) || $api['appid'] !== $this->appId) {
$new = true;
}
if (empty($api['appsecret']) || $api['appsecret'] !== $this->appSecret) {
$new = true;
}
$data = cache_load("ewei.money.access_token.json::" . $_W['uniacid'], true);
if (empty($data['expire_time']) || $data['expire_time'] < time() || $new) {
$url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={$this->appId}&secret={$this->appSecret}";
$res = json_decode($this->httpGet($url));
$access_token = $res->access_token;
if ($access_token) {
$data['expire_time'] = time() + 7000;
$data['access_token'] = $access_token;
cache_write("ewei.money.access_token.json::" . $_W['uniacid'], iserializer($data));
cache_write("ewei.money.api_share.json::" . $_W['uniacid'], iserializer(array("appid" => $this->appId, "appsecret" => $this->appSecret)));
}
} else {
$access_token = $data['access_token'];
}
return $access_token;
}
示例4: setting_load
function setting_load($key = '')
{
global $_W;
$cachekey = "setting";
$settings = cache_load($cachekey);
if (empty($settings)) {
$settings = pdo_fetchall('SELECT * FROM ' . tablename('core_settings'), array(), 'key');
if (is_array($settings)) {
foreach ($settings as $k => &$v) {
$settings[$k] = iunserializer($v['value']);
}
}
cache_write($cachekey, $settings);
}
if (!is_array($_W['setting'])) {
$_W['setting'] = array();
}
$_W['setting'] = array_merge($_W['setting'], $settings);
return $settings;
}
示例5: mc_fetch
function mc_fetch($uid, $fields = array())
{
global $_W;
$uid = mc_openid2uid($uid);
if (empty($uid)) {
return array();
}
$struct = (array) cache_load('usersfields');
if (empty($fields)) {
$select = '*';
} else {
foreach ($fields as $field) {
if (!in_array($field, $struct)) {
unset($fields[$field]);
}
if ($field == 'birth') {
$fields[] = 'birthyear';
$fields[] = 'birthmonth';
$fields[] = 'birthday';
}
if ($field == 'reside') {
$fields[] = 'resideprovince';
$fields[] = 'residecity';
$fields[] = 'residedist';
}
}
unset($fields['birth'], $fields['reside']);
$select = '`uid`, `' . implode('`,`', $fields) . '`';
}
if (is_array($uid)) {
$result = pdo_fetchall("SELECT {$select} FROM " . tablename('mc_members') . " WHERE uid IN ('" . implode("','", is_array($uid) ? $uid : array($uid)) . "')", array(), 'uid');
foreach ($result as &$row) {
if (isset($row['avatar']) && !empty($row['avatar'])) {
$row['avatar'] = tomedia($row['avatar']);
}
}
} else {
$result = pdo_fetch("SELECT {$select} FROM " . tablename('mc_members') . " WHERE `uid` = :uid", array(':uid' => $uid));
if (isset($result['avatar']) && !empty($result['avatar'])) {
$result['avatar'] = tomedia($result['avatar']);
}
}
return $result;
}
示例6: account_weixin_remark
function account_weixin_remark($fakeid, $remark, $groupid = 0)
{
//备注
if (account_weixin_login()) {
global $_W;
$username = $_W['account']['username'];
if (empty($_W['cache']['wxauth'][$username])) {
cache_load('wxauth:' . $username . ':');
}
$auth = $_W['cache']['wxauth'][$username];
$url = WEIXIN_ROOT . '/cgi-bin/modifycontacts';
$post = array('remark' => $remark, 'tofakeuin' => $fakeid, 'token' => $auth['token'], 'lang' => 'zh_CN', 'action' => 'setremark', 't' => 'ajax-response');
$response = ihttp_request($url, $post, array('CURLOPT_COOKIE' => $auth['cookie'], 'CURLOPT_REFERER' => WEIXIN_ROOT . '/cgi-bin/contactmanage?t=user/index&pagesize=10&pageidx=0&type=0&groupid=' . $groupid . '&token=' . $auth['token'] . '&lang=zh_CN'));
$result = json_decode($response['content'], 1);
return $result;
}
return false;
}
示例7: account_yixin_basic
function account_yixin_basic($username)
{
global $wechat;
$auth = cache_load('yxauth:' . $username . ':');
$response = ihttp_request(YIXIN_ROOT . '/set', '', array('CURLOPT_COOKIE' => $auth['cookie']));
if (is_error($response)) {
return array();
}
$info = array();
preg_match('/icon\\:\\"(.*?)\\"/', $response['content'], $match);
$image = ihttp_request($match[1]);
file_write('headimg_' . $wechat['weid'] . '.jpg', $image['content']);
preg_match('/qrCodeMix\\:\\"(.*?)\\"/', $response['content'], $match);
$image = ihttp_request($match[1]);
file_write('qrcode_' . $wechat['weid'] . '.jpg', $image['content']);
preg_match('/signature\\:\\"(.*?)\\"/', $response['content'], $match);
$info['signature'] = $match[1];
preg_match('/帐号名称<\\/div>(.*?)<\\/div>/', $response['content'], $match);
$info['username'] = strip_tags($match[1]);
return $info;
}
示例8: defined
/**
* @FreeGo Team 智慧游
* @url http://www.cninone.com/
*/
defined('IN_IA') or exit('Access Denied');
set_time_limit(0);
load()->model('cloud');
load()->func('communication');
load()->model('extension');
$r = cloud_prepare();
if (is_error($r)) {
message($r['message'], url('cloud/profile'), 'error');
}
$do = !empty($_GPC['do']) && in_array($do, array('module', 'system')) ? $_GPC['do'] : exit('Access Denied');
if ($do == 'system') {
$lock = cache_load('checkupgrade:system');
if (empty($lock) || TIMESTAMP - 3600 > $lock['lastupdate']) {
$upgrade = cloud_build();
if (!is_error($upgrade) && !empty($upgrade['upgrade'])) {
$upgrade = array('version' => $upgrade['version'], 'release' => $upgrade['release'], 'upgrade' => 1, 'lastupdate' => TIMESTAMP);
cache_write('checkupgrade:system', $upgrade);
message($upgrade, '', 'ajax');
} else {
$upgrade = array('lastupdate' => TIMESTAMP);
cache_write('checkupgrade:system', $upgrade);
}
} else {
message($lock, '', 'ajax');
}
} elseif ($do == 'module') {
$modulename = $_GPC['m'];
示例9: in_array
$do = in_array($do, $dos) ? $do : 'upgrade';
if ($do == 'upgrade') {
$_W['page']['title'] = '一键更新 - 云服务';
if (checksubmit('submit')) {
$upgrade = cloud_build();
if (is_error($upgrade)) {
message($upgrade['message'], '', 'error');
}
if ($upgrade['upgrade']) {
message("检测到新版本: <strong>{$upgrade['version']} (Release {$upgrade['release']})</strong>, 请立即更新.", 'refresh');
} else {
cache_delete('checkupgrade:system');
message('检查结果: 恭喜, 你的程序已经是最新版本. ', 'refresh');
}
}
cache_load('upgrade');
if (!empty($_W['cache']['upgrade'])) {
$upgrade = $_W['cache']['upgrade'];
}
if (empty($upgrade) || TIMESTAMP - $upgrade['lastupdate'] >= 3600 * 24 || $upgrade['upgrade']) {
$upgrade = cloud_build();
}
if (!empty($upgrade['schemas'])) {
$upgrade['database'] = array();
foreach ($upgrade['schemas'] as $remote) {
$row = array();
$row['tablename'] = $remote['tablename'];
$name = substr($remote['tablename'], 4);
$local = db_table_schema(pdo(), $name);
unset($remote['increment']);
unset($local['increment']);
示例10: array
<?php
require 'include/core/common.php';
require PATHS_INCLUDE . 'libraries/register.lib.php';
$ui_options['menu_path'] = array('hamsterpaj');
$ui_options['stylesheets'][] = 'rounded_corners_tabs.css';
$ui_options['title'] = 'Bli medlem på Hamsterpaj.net';
$ui_options['stylesheets'][] = 'register.css';
ui_top($ui_options);
$register_suspend = cache_load('register_suspend');
if ($register_suspend == 'disabled') {
echo '<h1>Registreringsfunktionen är tillfälligt avstängd</h1>' . "\n";
echo '<p>Det här händer jäkligt sällan, men nu har vi stängt av registreringen - det går inte att skapa konton på Hamsterpaj just nu. Funktionen är antagligen igång inom en timma, titta hit igen då!</p>' . "\n";
ui_bottom();
exit;
}
if (login_checklogin()) {
echo '<h1>Du kan inte skapa en ny användare när du redan är inloggad!</h1>';
ui_bottom();
exit;
}
if (isset($_POST['username'])) {
$data_ok = register_check($_POST);
if ($data_ok !== true) {
regform_header_fail();
register_form($_POST, $data_ok);
} else {
event_log_log('classic_reg_form_sign_up');
/* Input from user is OK, create rows in required tables */
$query = 'INSERT INTO login(username, password, regtimestamp, regip, lastlogon) ';
$query .= 'VALUES ("' . $_POST['username'] . '", "' . md5(utf8_decode($_POST['password'])) . '", "';
示例11: cache_load
<?php
$threads = cache_load('latest_forum_posts');
$return .= '<ul>' . "\n";
foreach ($threads as $thread) {
$thread['title'] = mb_strlen($thread['title'], 'UTF8') > 22 ? mb_substr($thread['title'], 0, 19, 'UTF8') . '...' : $thread['title'];
$info = 'I ' . $thread['category_title'] . ' av ' . $thread['username'];
$return .= '<li>' . date('H:i', $thread['last_post_timestamp']) . ' <a title="' . $info . '" href="' . $thread['url'] . '">' . $thread['title'] . '</a></li>' . "\n";
}
$return .= '</ul>' . "\n";
示例12: getRedirectInfos
private function getRedirectInfos()
{
global $_W, $_GPC;
$sql = 'SELECT * FROM ' . tablename('modules_bindings') . " WHERE `entry` IN ('home', 'profile')";
$es = pdo_fetchall($sql);
$_W['account']['modules'] = account_module();
cache_load('modules');
$ds = array();
if (is_array($es)) {
foreach ($es as $entry) {
$mid = $_W['modules'][$entry['module']]['mid'];
if (empty($mid) || !isset($_W['account']['modules'][$mid])) {
continue;
}
if (!empty($entry['call'])) {
//echo "<p>{$entry['module']}</p>";
// BUGFIX::XXX
// sns、exam这两个模块的方法有bug,调用会导致出错。暂时先回避。
if (in_array($entry['module'], array('vote', 'bigwheel', 'exam', 'sns', 'hotel2'))) {
continue;
}
if (true) {
continue;
}
$site = WeUtility::createModuleSite($entry['module']);
if (method_exists($site, $entry['call'])) {
$ret = $site->{$entry}['call']();
if (is_array($ret)) {
foreach ($ret as $et) {
$ds[] = array('module' => $entry['module'], 'from' => 'call', 'title' => $et['title'], 'url' => $et['url']);
}
}
}
} else {
$et = array('title' => $entry['title'], 'url' => create_url("mobile/entry", array('eid' => $entry['eid'], 'weid' => $_W['weid'])));
$ds[] = array('module' => $entry['module'], 'from' => 'define', 'title' => $et['title'], 'url' => $et['url']);
}
}
}
return $ds;
}
示例13: cache_load
<?php
$threads = cache_load('latest_forum_open_source_threads');
$return .= '<ul>' . "\n";
foreach ($threads as $thread) {
$thread['title'] = strlen($thread['title']) > 22 ? substr($thread['title'], 0, 19) . '...' : $thread['title'];
$info = 'I ' . $thread['category_title'] . ' av ' . $thread['username'];
$return .= '<li>' . date('H:i', $thread['timestamp']) . ' <a title="' . $info . '" href="' . $thread['url'] . '">' . $thread['title'] . '</a></li>' . "\n";
}
$return .= '</ul>' . "\n";
示例14: substr
$noCache = $_GET["nocache"];
if ($noCache) { $cfg["cacheEnabled"] = false; }
$force = $_GET["force"]; // ignore errors;
// ----------------------------------------------------------------------------
// File name + extension
$imgName = substr($imgFile, strrpos($imgFile,"/")+1);
$imgSrcExtension = strtolower(substr($imgFile, strrpos($imgFile,".")+1));
// Check Cache
if ($cfg["cacheEnabled"]) {
// Check if image is available from cache, if so: show it
$imgCache = cache_load($imgFile, $thWidth, $thHeight);
if ($imgCache) { //header("location: $imgCache");
$content = fr($imgCache);
if (strtolower($imgSrcExtension)=="jpg") { $type = "jpeg"; }
else { $type = strtolower($imgSrcExtension); }
header("Content-Disposition: filename=\"{$imgName}\"");
header("Content-type: image/{$type}");
echo $content;
setIdle();
die();
}
}
// Handle if image is located on remote server
if ($imgIsRemote) {
示例15: array
<?php
require '../include/core/common.php';
require_once PATHS_LIBRARIES . 'schedule.lib.php';
$ui_options['menu_path'] = array('admin', 'registrering');
if (!is_privilegied('register_suspend_admin')) {
header('location: /');
die;
}
ui_top($ui_options);
if (isset($_POST)) {
cache_save('register_suspend', $_POST['reg_status']);
}
$reg_status = cache_load('register_suspend');
if ($reg_status == 'disabled') {
echo '<h1>Användarregistreringen är avstängd</h1>' . "\n";
} else {
echo '<h1>Användarregistreringen är aktiv</h1>' . "\n";
}
echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">' . "\n";
echo '<input type="submit" value="disabled" name="reg_status" />' . "\n";
echo '<input type="submit" value="enabled" name="reg_status" />' . "\n";
echo '</form>' . "\n";
ui_bottom();