本文整理汇总了PHP中get_cache函数的典型用法代码示例。如果您正苦于以下问题:PHP get_cache函数的具体用法?PHP get_cache怎么用?PHP get_cache使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_cache函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* 邀请注册
*/
function index()
{
$uid = intval($GLOBALS['uid']);
if (!$uid) {
header("Location:" . WEBURL);
exit;
}
$_uid = get_cookie('_uid');
if ($_uid && is_numeric($_uid)) {
//已经登录的用户不算成功推广的下线
header("Location:" . WEBURL);
exit;
} else {
$times = SYS_TIME + 86400 * 7;
set_cookie('ppc_uid', $uid, $times);
$db = load_class('db');
$ip = get_ip();
$db->insert('ppc', array('uid' => $uid, 'addtime' => SYS_TIME, 'ip' => $ip));
//后台配置推广页面跳转地址
$setting = get_cache('setting', 'ppc');
if (empty($setting['redirect_url'])) {
MSG('请在后台配置推广页面地址');
}
header("Location:" . $setting['redirect_url']);
}
}
示例2: get_pro_config_content
/**
* 获取配置中的配置内容content
* @param string $cKey 配置key
*/
function get_pro_config_content($cKey)
{
$conf = get_cache('ProConfig');
$conf = $conf[$cKey];
$content = $conf['content'];
return unserialize($content);
}
示例3: active_email
public function active_email()
{
if (!isset($GLOBALS['auth']) || !isset($GLOBALS['uid']) || !isset($GLOBALS['email']) || !isset($GLOBALS['t'])) {
MSG('验证失败!');
}
$auth = $GLOBALS['auth'];
$uid = intval($GLOBALS['uid']);
$email = $GLOBALS['email'];
$t = $GLOBALS['t'];
if (decode($auth) != $t . $uid . $email) {
MSG('验证失败!');
}
if ($t < SYS_TIME - 3600) {
MSG('邮件验证超时,请重新验证!', 'index.php?m=member&f=index&v=edit_email');
}
$this->db->update('member', array('ischeck_email' => 1), array('uid' => $uid));
$point_config = get_cache('point_config');
$credit_api = load_class('credit_api', 'credit');
$keyid = 'em' . $uid;
//验证邮箱,只送一次
if (!$credit_api->get($keyid)) {
$credit_api->handle($uid, '+', $point_config['email_check'], '验证邮箱:' . $email, '', $keyid);
}
MSG('邮件验证成功!', 'index.php?m=member&f=index&v=account_safe');
}
示例4: track
function track($data)
{
$cache_key = 'click_' . $data['h'] . '';
if (MAD_TRACK_UNIQUE_CLICKS) {
$cache_result = get_cache($cache_key);
if ($cache_result && $cache_result == 1) {
return false;
} else {
set_cache($cache_key, 1, 500);
}
}
if (!is_numeric($data['zone_id'])) {
return false;
}
/* Get the Publication */
$query = "SELECT publication_id FROM md_zones WHERE entry_id='" . $data['zone_id'] . "'";
$zone_detail = simple_query_maindb($query, true, 1000);
if (!$zone_detail or $zone_detail['publication_id'] < 1) {
return false;
}
switch ($data['type']) {
case 'normal':
reporting_db_update($zone_detail['publication_id'], $data['zone_id'], $data['campaign_id'], $data['ad_id'], '', 0, 0, 0, 1);
break;
case 'network':
reporting_db_update($zone_detail['publication_id'], $data['zone_id'], $data['campaign_id'], '', $data['network_id'], 0, 0, 0, 1);
break;
case 'backfill':
reporting_db_update($zone_detail['publication_id'], $data['zone_id'], '', '', $data['network_id'], 0, 0, 0, 1);
break;
}
}
示例5: listing
public function listing()
{
$where = '';
$keywords = '';
$cid = intval($GLOBALS['cid']);
$categorys = get_cache('category', 'content');
$modelid = $categorys[$cid]['modelid'];
$model_r = $this->db->get_one('model', array('modelid' => $modelid));
$master_table = $model_r['master_table'];
$where = "cid='{$cid}'";
if (isset($GLOBALS['keywords'])) {
if (isset($GLOBALS['charset']) && strtolower(CHARSET) == 'gbk') {
$keywords = iconv('utf-8', 'gbk', $GLOBALS['keywords']);
} else {
$keywords = $GLOBALS['keywords'];
}
$keywords = trim(sql_replace($keywords));
// $master_table = 'content_share';
if (isset($GLOBALS['keytype']) && $GLOBALS['keytype'] == 'username') {
$where .= " AND `publisher` = '{$keywords}'";
} else {
$GLOBALS['keytype'] = 'keywords';
$where .= "AND `title` LIKE '%{$keywords}%'";
}
}
$page = isset($GLOBALS['page']) ? intval($GLOBALS['page']) : 1;
$result = $this->db->get_list($master_table, $where, '*', 0, 10, $page, 'id DESC');
$form = load_class('form');
include $this->template('relation_listing');
}
示例6: alipay_redirect
/**
* 支付宝: 跳转到支付界面
* @param $config
*/
function alipay_redirect($config)
{
/*
* @var Omnipay\Alipay\WapExpressGateway
*/
try {
// $gateway = \Omnipay\Omnipay::create('Alipay_WapExpress')
$gateway = new \Omnipay\Baifu\ExpressGateway();
$gateway->setPartner($config['partner']);
$gateway->setKey($config['key']);
$gateway->setNotifyUrl($config['notify_url']);
$gateway->setReturnUrl($config['return_url']);
$gateway->setCertPath($config['cert_path']);
$opts = array('sp_pass_through' => '%7B%22offline_pay%22%3A1%7D', 'subject' => $_GET['subject'], 'description' => '暂无', 'total_fee' => $_GET['total_fee'], 'out_trade_no' => $_GET['out_trade_no']);
$res = $gateway->purchase($opts)->send();
// $res = $gateway->completePurchase($opts)->send();
// $abc = [ 'result' => $res->getTransactionReference(), 'trade_status' => $res->isTradeStatusOk()];
// var_dump($abc);
$cache = get_cache();
$cache->save($_GET['out_trade_no'], $opts);
$res->redirect();
// header("Content-type: application/json");
// echo json_encode([
// 'url' => $res->getRedirectUrl(),
// 'opts' => $opts,
// 'config' => $config,
// 'info_url' => 'http://' . $_SERVER['HTTP_HOST'] . '/demo/info.php?out_trade_no=' . $out_trade_no,
// ]);
} catch (\Exception $e) {
var_dump($e->getMessage());
}
}
示例7: list_centers
function list_centers()
{
//HTML flow
$html = "";
//Get centers from DWBN or cache
if (@$_GET['source'] == 'cache') {
//Get from cache
$members = get_cache();
//Be beware! It's cache
$html .= "<span class='warning'>Pay attention! This is from cache!</span><br/><br/>";
} else {
//Collect information from DWBN
$members = dwbn_collect();
}
//Show collected information{
//Number of centers
$html .= "Number of centers: " . count($members) . "<br/><br/>";
//Example of center{
$html .= "<pre>" . print_r($members[0], true) . "</pre><br/>";
//}
//Centers info
foreach ($members as $center) {
$html .= $center['email'] . "<br/>";
}
//}
//Return
return $html;
}
示例8: editAction
public function editAction()
{
$userid = (int) $this->get('userid');
$data = $this->db->setTableName('admin')->find($userid);
$auth = string2array($data['auth']);
$cats = get_cache('category');
if (empty($data)) {
$this->show_message('该用户不存在', 2);
}
if ($this->post('submit')) {
$data = $this->post('data');
if (!empty($data['password'])) {
if (strlen($data['password']) < 6) {
$this->show_message('密码最少6位数', 2, 1);
}
$data['password'] = md5(md5($data['password']));
} else {
unset($data['password']);
}
$auth = $this->post('auth');
$data['auth'] = array2string($auth);
$this->db->setTableName('admin')->update($data, 'userid=?', $userid);
$this->cacheAction();
$this->show_message('修改成功', 1);
}
include $this->admin_tpl('admin_add');
}
示例9: alipay_redirect
/**
* 支付宝: 跳转到支付界面
* @param $config
*/
function alipay_redirect($config)
{
/*
* @var Omnipay\Alipay\WapExpressGateway
*/
try {
// $gateway = \Omnipay\Omnipay::create('Alipay_WapExpress')
$gateway = new \Omnipay\Alipay\WapExpressGateway();
$gateway->setPartner($config['partner']);
$gateway->setKey($config['key']);
$gateway->setSellerEmail($config['seller_email']);
$gateway->setNotifyUrl($config['notify_url']);
$gateway->setReturnUrl($config['return_url']);
$gateway->setCancelUrl($config['cancel_url']);
$opts = array('subject' => $_GET['subject'], 'description' => '暂无', 'total_fee' => $_GET['total_fee'], 'out_trade_no' => $_GET['out_trade_no']);
$res = $gateway->purchase($opts)->send();
$cache = get_cache();
$cache->save($_GET['out_trade_no'], $opts);
$res->redirect();
// header("Content-type: application/json");
// echo json_encode([
// 'url' => $res->getRedirectUrl(),
// 'opts' => $opts,
// 'config' => $config,
// 'info_url' => 'http://' . $_SERVER['HTTP_HOST'] . '/demo/info.php?out_trade_no=' . $out_trade_no,
// ]);
} catch (\Exception $e) {
var_dump($e->getMessage());
}
}
示例10: show
public function show()
{
load_function('common', 'member');
$siteconfigs = $this->siteconfigs;
$id = isset($GLOBALS['id']) ? intval($GLOBALS['id']) : MSG(L('parameter_error'));
$categorys = get_cache('category', 'content');
//查询数据
$models = get_cache('model_guestbook', 'model');
$model_r = $models[15];
$master_table = $model_r['master_table'];
$data = $this->db->get_one($master_table, array('id' => $id));
require get_cache_path('content_format', 'model');
$form_format = new form_format($model_r['modelid']);
$data = $form_format->execute($data);
foreach ($data as $_key => $_value) {
${$_key} = $_value['data'];
}
$_template = TPLID . ':show';
$styles = explode(':', $_template);
$project_css = isset($styles[0]) ? $styles[0] : 'default';
$_template = isset($styles[1]) ? $styles[1] : 'show';
$seo_title = $title . '_' . $siteconfigs['sitename'];
$seo_keywords = !empty($keywords) ? implode(',', $keywords) : '';
$seo_description = $remark;
$this->db->update($master_table, "`hits`=(`hits`+1)", array('id' => $id));
include T('guestbook', 'show');
}
示例11: notify_callback
function notify_callback($config, $get, $raw_post)
{
$cache = get_cache();
try {
$gateway = new \Omnipay\Wechat\ExpressGateway();
$gateway->setAppId($config['app_id']);
$gateway->setKey($config['pay_sign_key']);
$gateway->setPartner($config['partner']);
$gateway->setPartnerKey($config['partner_key']);
$cache->save(LAST_NOTIFY_CACHE_KEY, func_get_args());
$response = $gateway->completePurchase(array('request_params' => $get, 'body' => $raw_post))->send();
if ($response->isSuccessful() && $response->isTradeStatusOk()) {
//todo success
$serial = $cache->fetch($get['out_trade_no']);
$serial['notify'] = array('status' => 'success', 'param' => http_build_query($get), 'body' => $raw_post);
$data = json_decode(json_encode(simplexml_load_string($raw_post, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
$cache->save($get['out_trade_no'], $serial);
$cache->save(LAST_NOTIFY_CACHE_KEY, array('param' => http_build_query($get), 'body' => $raw_post, 'data' => $data, 'status' => $response->getMessage()));
$cache->delete(LAST_ERROR_CACHE_KEY);
die($response->getMessage());
// die('success');
} else {
die($response->getMessage());
}
} catch (\Exception $e) {
$cache->save(LAST_ERROR_CACHE_KEY, $e->getLine() . ': ' . $e->getMessage());
die('exception: ' . $e->getLine() . ' - ' . $e->getMessage());
}
}
示例12: listing
/**
* 列表标签
*
* @param $c
* @return array
*/
public function listing($c)
{
if (!isset($c['keyid'])) {
return array();
}
if (isset($c['urlrule'])) {
$urlrule = $c['urlrule'];
} else {
$urlrule = 'javascript:dp_page({$page});';
}
$rule_arr = array('page' => $c['page']);
$result = $this->db->get_list('dianping', array('keyid' => $c['keyid']), '*', $c['start'], $c['pagesize'], $c['page'], 'id DESC', '', '', $urlrule, $rule_arr);
$groups = get_cache('group', 'member');
$newdata = array();
foreach ($result as $rs) {
if ($rs['uid']) {
$r = $this->db->get_one('member', array('uid' => $rs['uid']));
$rs['username'] = $r['username'];
$rs['groupid'] = $r['groupid'];
$rs['groupname'] = $groups[$r['groupid']]['name'];
}
$newdata[] = $rs;
}
if ($c['page']) {
$this->pages = $this->db->pages;
$this->number = $this->db->number;
}
return $newdata;
}
示例13: clean_terms
function clean_terms($terms)
{
# if we've got a cached version of the results from this function use it...
$id = md5(implode(',', $terms));
$cached = get_cache($id);
if ($cached) {
return unserialize($cached);
}
# go through the terms in sequence to see what the counts with non-duplicated posts are...
$posts_seen = array();
foreach ($terms as $term => $freq) {
$term = mysql_escape_string($term);
$query = "SELECT DISTINCT post_id FROM terms WHERE term='{$term}'";
$results = mysql_query($query);
while ($row = mysql_fetch_assoc($results)) {
$post_id = $row['post_id'];
if ($posts_seen[$post_id]) {
$terms[$term]--;
if ($terms[$term] <= 0) {
unset($terms[$term]);
}
}
$posts_seen[$post_id] = true;
}
}
arsort($terms);
# cache results
$cached = serialize($terms);
cache($id, $cached);
return $terms;
}
示例14: listing
/**
* 推荐的用户
*/
public function listing()
{
$page = isset($GLOBALS['page']) ? intval($GLOBALS['page']) : 1;
$page = max($page, 1);
$uid = $this->memberinfo['uid'];
$categorys = get_cache('category', 'content');
$publisher = $this->memberinfo['username'];
$result_rs = $this->db->get_list('friend_elite', "`cityid` IN (0)", '*', 0, 20, $page, 'id DESC');
$result = array();
foreach ($result_rs as $r) {
$r['member_info'] = $this->db->get_one('member', array('uid' => $r['uid']));
$v1 = $this->db->get_one('myfriend', array('myuid' => $r['uid'], 'uid' => $uid));
$v2 = $this->db->get_one('myfriend', array('myuid' => $uid, 'uid' => $r['uid']));
if ($v2 && $v1) {
//相互关注
$r['rtype'] = 1;
} elseif ($v2) {
$r['rtype'] = 2;
//已添加
} elseif ($v1) {
$r['rtype'] = 3;
//请求添加
}
$result[] = $r;
}
$pages = $this->db->pages;
$total = $this->db->number;
include $this->template('friend_listing');
}
示例15: cache_select
public function cache_select()
{
$uid = $_SESSION['uid'];
if (isset($GLOBALS['setcache'])) {
$ids = get_cache('cache_all-' . $uid);
} else {
if (!isset($GLOBALS['ids']) || empty($GLOBALS['ids'])) {
$where = array('keyid' => 'cache_all');
$result = $this->db->get_list('setting', $where, '*', 0, 100);
$ids = array();
foreach ($result as $r) {
$ids[] = $r['id'];
}
} else {
$ids = array_map('intval', $GLOBALS['ids']);
}
set_cache('cache_all-' . $uid, $ids);
}
if (empty($ids)) {
MSG('缓存更新完成', '?m=core&f=cache_all&v=index' . $this->su(), 2000);
}
$id = array_shift($ids);
$r = $this->db->get_one('setting', array('id' => $id));
$caches = load_class($r['f'], $r['m']);
if ($caches->{$r}['v']()) {
set_cache('cache_all-' . $uid, $ids);
MSG($r['data'] . L('update success'), '?m=core&f=cache_all&v=cache_select&setcache=1&' . $this->su(), 200);
} else {
MSG(L('operation failure'));
}
}