本文整理汇总了PHP中cache_read函数的典型用法代码示例。如果您正苦于以下问题:PHP cache_read函数的具体用法?PHP cache_read怎么用?PHP cache_read使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cache_read函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCacheTypes
function getCacheTypes()
{
if (!isset($_PB_CACHE['newstype'])) {
$_PB_CACHE['newstype'] = cache_read("type", "newstype");
}
return $_PB_CACHE['newstype'];
}
示例2: Search
function Search($firstcount, $displaypg)
{
global $cache_types;
uses("space", "industry", "area");
$space = new Space();
$area = new Areas();
$industry = new Industries();
$cache_options = cache_read('typeoption');
$area_s = $space->array_multi2single($area->getCacheArea());
$industry_s = $space->array_multi2single($industry->getIndustry());
$result = $this->findAll("*,name AS title,description AS digest", null, null, $this->orderby, $firstcount, $displaypg);
if (!isset($_PB_CACHE['membergroup'])) {
require CACHE_PATH . "cache_membergroup.php";
}
while (list($keys, $values) = each($result)) {
$r = array();
$result[$keys]['pubdate'] = df($values['created']);
$result[$keys]['typename'] = $cache_options['manage_type'][$values['manage_type']];
$result[$keys]['thumb'] = $result[$keys]['logo'] = pb_get_attachmenturl($values['picture'], '', 'small');
$result[$keys]['gradeimg'] = URL . 'images/group/' . $_PB_CACHE['membergroup'][$result[$keys]['cache_membergroupid']]['avatar'];
$result[$keys]['gradename'] = $_PB_CACHE['membergroup'][$result[$keys]['cache_membergroupid']]['name'];
if (!empty($result[$keys]['area_id'])) {
$r[] = $area_s[$result[$keys]['area_id']];
}
if (!empty($result[$keys]['industry_id'])) {
$r[] = $industry_s[$result[$keys]['industry_id']];
}
$r[] = L("integrity_index", "tpl") . "(" . $result[$keys]['cache_credits'] . ")";
if (!empty($r)) {
$result[$keys]['extra'] = implode(" - ", $r);
}
$result[$keys]['url'] = $space->rewrite($values['member_id'], $values['id']);
}
return $result;
}
示例3: index
function index()
{
global $viewhelper;
$conditions = array();
$viewhelper->setTitle(L("announce", "tpl"));
$types = cache_read("type");
$viewhelper->setPosition(L("announce", "tpl"), "index.php?do=announce");
if (!empty($_GET['typeid'])) {
$conditions[] = "announcetype_id=" . intval($_GET['typeid']);
}
$result = $this->announcement->findAll("*", null, $conditions, "display_order ASC,id DESC");
if (!empty($result)) {
for ($i = 0; $i < count($result); $i++) {
if (!empty($result[$i]['created'])) {
$result[$i]['pubdate'] = date("Y-m-d", $result[$i]['created']);
$result[$i]['title'] = pb_lang_split($result[$i]['subject']);
$result[$i]['typename'] = $types['announcementtype'][$result[$i]['announcetype_id']];
$result[$i]['type_id'] = $result[$i]['announcetype_id'];
}
}
setvar("module", "announce");
setvar("items", $result);
}
render("list.default", true);
}
示例4: detail
function detail()
{
require CACHE_COMMON_PATH . "cache_type.php";
$_PB_CACHE['area'] = cache_read("area");
$_PB_CACHE['industry'] = cache_read("industry");
if (isset($_GET['title'])) {
$title = trim($_GET['title']);
$res = $this->expo->findByName($title);
$id = $res['id'];
}
if (isset($_GET['id'])) {
$id = intval($_GET['id']);
}
if (!$this->expo->checkExist($id, true)) {
flash("data_not_exists");
}
$info = $this->expo->info;
$this->view_helper->setPosition(L("fair", "tpl"));
if (!empty($info)) {
$info['typename'] = $_PB_CACHE['expotype'][$info['expotype_id']];
$this->view_helper->setTitle($info['typename']);
$this->view_helper->setPosition($info['typename'], 'index.php?do=fair&action=lists&typeid=' . $info['expotype_id']);
$this->view_helper->setTitle($info['name']);
$this->view_helper->setPosition($info['name']);
$result = $this->expo->dbstuff->GetArray("SELECT c.name,c.id,c.cache_spacename AS userid FROM {$this->expo->table_prefix}expomembers em LEFT JOIN {$this->expo->table_prefix}companies c ON c.id=em.company_id WHERE c.status=1");
$result = pb_lang_split_recursive($result);
$info = pb_lang_split_recursive($info);
if (!empty($result)) {
setvar("Items", $result);
}
setvar("item", $info);
}
render("fair/detail");
}
示例5: Search
function Search($firstcount, $displaypg)
{
global $cache_types;
uses("space", "industry", "area");
$space = new Space();
$area = new Areas();
$industry = new Industries();
$cache_options = cache_read('typeoption');
$area_s = $space->array_multi2single($area->getCacheArea());
$industry_s = $space->array_multi2single($area->getCacheArea());
$result = $this->findAll("*,name AS title,content AS digest", null, null, $this->orderby, $firstcount, $displaypg);
while (list($keys, $values) = each($result)) {
$result[$keys]['typename'] = $cache_types['productsort'][$values['sort_id']];
$result[$keys]['thumb'] = pb_get_attachmenturl($values['picture'], '', 'small');
$result[$keys]['pubdate'] = df($values['begin_time']);
if (!empty($result[$keys]['area_id'])) {
$r1 = $area_s[$result[$keys]['area_id']];
}
if (!empty($result[$keys]['cache_companyname'])) {
$r2 = "<a href='" . $space->rewrite($result[$keys]['cache_companyname'], $result[$keys]['company_id']) . "'>" . $result[$keys]['cache_companyname'] . "</a>";
}
if (!empty($r1) || !empty($r2)) {
$result[$keys]['extra'] = implode(" - ", array($r1, $r2));
}
$result[$keys]['url'] = $this->getPermaLink($values['id']);
}
return $result;
}
示例6: cache_load
/**
* 读取缓存,并将缓存加载至 $_W 全局变量中
* @param string $key 缓存键名,如果键名以:结束,则做为分组名称读取所有缓存
*
*/
function cache_load($key, $unserialize = false)
{
global $_W;
if (substr($key, -1) == ':') {
$data = cache_search($key);
foreach ($data as $k => $v) {
$tmp =& cache_global($k);
$tmp = $unserialize ? iunserializer($v) : $v;
}
return cache_global($key);
} else {
$data = cache_read($key);
if ($key == 'setting') {
$_W['setting'] = $data;
return $_W['setting'];
} elseif ($key == 'modules') {
$_W['modules'] = $data;
return $_W['modules'];
} else {
$tmp =& cache_global($key);
$tmp = $unserialize ? iunserializer($data) : $data;
return $unserialize ? iunserializer($data) : $data;
}
}
}
示例7: getAttributes
function getAttributes($attribute_ids = 0, $form_id = 1)
{
$_PB_CACHE['form'] = cache_read("form");
$result = $data = array();
$condition = null;
$data = $_PB_CACHE['form'][$form_id];
if (!empty($attribute_ids)) {
if (is_array($attribute_ids)) {
$tmp = implode(",", $attribute_ids);
$tmp = "id IN (" . $tmp . ")";
} else {
$tmp = "id=" . intval($attribute_ids);
}
$condition = " WHERE " . $tmp;
$sql = "SELECT id,form_id,formitem_id,attribute FROM {$this->table_prefix}formattributes{$condition}";
$result = $this->dbstuff->GetArray($sql);
}
if (!empty($result)) {
foreach ($result as $key => $val) {
$tmp_result[$val['formitem_id']] = $val['attribute'];
}
foreach ($data as $key => $val) {
if (!empty($tmp_result[$key])) {
$data[$key]['value'] = $tmp_result[$key];
}
}
}
return $data;
}
示例8: get_list
function get_list($condition = '1', $order = 'listorder DESC, itemid DESC')
{
global $MODULE, $MOD, $pages, $page, $pagesize, $offset, $sum;
if ($page > 1 && $sum) {
$items = $sum;
} else {
$r = $this->db->get_one("SELECT COUNT(*) AS num FROM {$this->table} WHERE {$condition}");
$items = $r['num'];
}
$pages = pages($items, $page, $pagesize);
$GROUP = cache_read('group.php');
$lists = array();
$result = $this->db->query("SELECT * FROM {$this->table} WHERE {$condition} ORDER BY {$order} LIMIT {$offset},{$pagesize}");
while ($r = $this->db->fetch_array($result)) {
$r['adddate'] = timetodate($r['addtime'], 5);
$r['thumb'] = is_file(DT_ROOT . '/' . $MODULE[4]['moduledir'] . '/skin/' . $r['skin'] . '/thumb.gif') ? $MODULE[4]['linkurl'] . 'skin/' . $r['skin'] . '/thumb.gif' : $MODULE[4]['linkurl'] . 'image/nothumb.gif';
$groupid = explode(',', substr($r['groupid'], 1, -1));
$group = array();
foreach ($groupid as $gid) {
$group[] = $GROUP[$gid]['groupname'];
}
$r['group'] = implode('<br/>', $group);
$lists[] = $r;
}
return $lists;
}
示例9: setNames
function setNames()
{
if (func_num_args() < 1) {
return;
}
$return = array();
$_PB_CACHE['industry'] = cache_read("industry");
$args = func_get_args();
foreach ($args as $key => $val) {
$return[] = isset($_PB_CACHE['industry'][$val]) ? $_PB_CACHE['industry'][$val] : '';
}
$this->names = $return;
}
示例10: cache_load
function cache_load($key, $unserialize = false)
{
global $_W;
$data = $_W['cache'][$key] = cache_read($key);
if ($key == 'setting') {
$_W['setting'] = $data;
return $_W['setting'];
} elseif ($key == 'modules') {
$_W['modules'] = $data;
return $_W['modules'];
} else {
return $unserialize ? iunserializer($data) : $data;
}
}
示例11: set
function set($post)
{
global $MOD, $DT_TIME, $DT_IP, $AREA, $_username, $_userid;
$AREA or $AREA = cache_read('area.php');
$post['city'] or $post['city'] = $post['areaid'] ? $AREA[$post['areaid']]['areaname'] : '';
is_url($post['thumb']) or $post['thumb'] = '';
$post['filepath'] = isset($post['filepath']) && is_filepath($post['filepath']) ? file_vname($post['filepath']) : '';
$post['addtime'] = isset($post['addtime']) && $post['addtime'] ? strtotime($post['addtime']) : $DT_TIME;
$post['edittime'] = $DT_TIME;
$post['fromtime'] = strtotime($post['fromtime'] . ' 0:0:0');
$post['totime'] = strtotime($post['totime'] . ' 23:59:59');
$post['homepage'] = fix_link($post['homepage']);
$post['sign'] = $post['sign'] ? 1 : 0;
$post['fee'] = dround($post['fee']);
$post['content'] = stripslashes($post['content']);
$post['content'] = save_local($post['content']);
if ($MOD['clear_link']) {
$post['content'] = clear_link($post['content']);
}
if ($MOD['save_remotepic']) {
$post['content'] = save_remote($post['content']);
}
if ($MOD['introduce_length']) {
$post['introduce'] = addslashes(get_intro($post['content'], $MOD['introduce_length']));
}
if ($this->itemid) {
$post['editor'] = $_username;
$new = $post['content'];
if ($post['thumb']) {
$new .= '<img src="' . $post['thumb'] . '"/>';
}
$r = $this->get_one();
$old = $r['content'];
if ($r['thumb']) {
$old .= '<img src="' . $r['thumb'] . '"/>';
}
delete_diff($new, $old);
} else {
$post['username'] = $post['editor'] = $_username;
$post['ip'] = $DT_IP;
}
$content = $post['content'];
unset($post['content']);
$post = dhtmlspecialchars($post);
$post['content'] = addslashes(dsafe($content));
return array_map("trim", $post);
}
示例12: getJsApiTicket
private function getJsApiTicket()
{
$ticket = cache_read("js_api_ticket");
if (empty($ticket) || $ticket["time"] <= time()) {
$token = $this->getWxAccessToken();
if (!empty($token)) {
$url = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token={$token}&type=jsapi";
$js_token = ihttp_request($url);
if (!empty($js_token)) {
$content = @json_decode($js_token['content'], true);
$ticket = array("ticket" => $content["ticket"], "time" => TIMESTAMP + $content["expires_in"]);
cache_write("js_api_ticket", $ticket);
}
}
}
return $ticket["ticket"];
}
示例13: getUsergroups
function getUsergroups($type = 'all')
{
//system,special,define
$return = array();
$G['membergroup'] = cache_read("membergroup");
$typeid = strval($type);
foreach ($G['membergroup'] as $key => $val) {
if ($typeid == 'all') {
$return[$key] = $val['name'];
} else {
if ($typeid == $val['type']) {
$return[$key] = $val['name'];
}
}
}
ksort($return);
return $return;
}
示例14: getInfoById
function getInfoById($member_id)
{
$tmp_img = null;
$G['membergroup'] = cache_read("membergroup");
$G['trusttype'] = cache_read("trusttype");
$result = array();
$sql = "SELECT m.*,mf.* FROM {$this->table_prefix}members m LEFT JOIN {$this->table_prefix}memberfields mf ON mf.member_id=m.id WHERE m.id='{$member_id}'";
$result = $this->dbstuff->GetRow($sql);
if (!empty($result)) {
if (isset($result['link_man'])) {
$result['link_people'] = $result['link_man'];
}
$result['groupname'] = $G['membergroup'][$result['membergroup_id']]['name'];
$result['groupimage'] = STATICURL . "images/group/" . $G['membergroup'][$result['membergroup_id']]['avatar'];
if (!empty($result['trusttype_ids'])) {
$tmp_str = explode(",", $result['trusttype_ids']);
foreach ($tmp_str as $key => $val) {
$tmp_img .= "<img src=\"" . STATICURL . "images/icon/" . $G['trusttype'][$val]['avatar'] . "\" alt=\"" . $G['trusttype'][$val]['name'] . "\" />";
}
$result['trust_image'] = $tmp_img;
}
}
return $result;
}
示例15: open
/**
* open(host, port);
* @return: true if connection was successful, false otherwise
*/
function open($host, $port)
{
$conn_status = 1;
if (function_exists("cache_assign_key")) {
// checkig if we had a successful connection with the same server and the same port
// whithin the last GEKKO_REMOTE_TIMEOUT seconds
$key = cache_assign_key($host, $port);
if (($life = cache_check_life($key)) !== false && time() - $life < GEKKO_REMOTE_CONN_CACHE_LIFE) {
// if we had a successful connection we put a 1 in a cached file, this is for
// avoiding wasting time trying to connect to a specific server when it is not
// responding, we can check it later
cache_read($key, $conn_status);
}
}
// trying to connect if the last try was successful of if this is the first
if ($conn_status) {
$this->socket = @fsockopen($host, $port, $this->errno, $this->errstr, GEKKO_REMOTE_CONN_TIMEOUT);
}
// saving connection status
if (function_exists("cache_save") && $conn_status != $this->status()) {
cache_save($key, intval($this->status()));
}
return $conn_status ? $this->status() : false;
}