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


PHP cache_server函数代码示例

本文整理汇总了PHP中cache_server函数的典型用法代码示例。如果您正苦于以下问题:PHP cache_server函数的具体用法?PHP cache_server怎么用?PHP cache_server使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: _get_data

 function _get_data()
 {
     $cache_server =& cache_server();
     $key = $this->_get_cache_id();
     $data = $cache_server->get($key);
     if ($data === false) {
         $gcategory_mod =& bm('gcategory', array('_store_id' => 0));
         $gcategories = array();
         $brand_mod =& m('brand');
         if (empty($this->options['amount'])) {
             $gcategories = $gcategory_mod->get_list(-1, true);
         } else {
             $gcategory = $gcategory_mod->get_list(0, true);
             $gcategories = $gcategory;
             foreach ($gcategory as $val) {
                 $result = $gcategory_mod->get_list($val['cate_id'], true);
                 $result = array_slice($result, 0, $this->options['amount']);
                 $gcategories = array_merge($gcategories, $result);
             }
         }
         import('tree.lib');
         $tree = new Tree();
         $tree->setTree($gcategories, 'cate_id', 'parent_id', 'cate_name');
         $data = array('gcategories' => $tree->getArrayList(0), 'model_name' => $this->options['model_name'], 'brands' => $brand_mod->find(array('conditions' => "recommended = 1 AND if_show = 1", 'order' => 'sort_order', 'limit' => $this->_num)));
         $cache_server->set($key, $data, $this->_ttl);
     }
     return $data;
 }
开发者ID:dongfeihu,项目名称:estore,代码行数:28,代码来源:main.widget.php

示例2: _get_data

 function _get_data()
 {
     $cache_server =& cache_server();
     $key = $this->_get_cache_id();
     $data = $cache_server->get($key);
     if ($data === false) {
         $recom_mod =& m('recommend');
         $brand_mod =& m('brand');
         $data = array('goodslist' => $recom_mod->get_recommended_goods($this->options['img_recom_id'], $this->_num, true, $this->options['img_cate_id']), 'slides' => array(), 'brand' => $brand_mod->find(array('conditions' => "tag like '%{$this->options['bcategory']}'", 'order' => 'sort_order', 'limit' => 16)), 'model_name' => $this->options['model_name'], 'keyword_list' => explode(' ', $this->options['keyword_list']), 'ad0_image_url' => $this->options['ad0_image_url']);
         for ($i = 1; $i <= count($data['keyword_list']) * 5; $i++) {
             $data['ad' . $i . '_image_url'] = $this->options['ad' . $i . '_image_url'];
             $data['ad' . $i . '_link_url'] = $this->options['ad' . $i . '_link_url'];
             $data['ad' . $i . '_title'] = $this->options['ad' . $i . '_title'];
         }
         $cache_server->set($key, $data, $this->_ttl);
     }
     $keyword_list_ss = array();
     foreach ($data['keyword_list'] as $key => $value) {
         if (!empty($value)) {
             for ($i = 1; $i <= 5; $i++) {
                 $k = $key * 5 + $i;
                 $keyword_list_ss[$key][$i]['img_url'] = $data['ad' . $k . '_image_url'];
                 $keyword_list_ss[$key][$i]['link'] = $data['ad' . $k . '_link_url'];
                 $keyword_list_ss[$key][$i]['title'] = $data['ad' . $k . '_title'];
             }
         }
     }
     // echo "<pre>";
     // print_r($keyword_list_ss);
     $this->assign('keyword_list_ss', $keyword_list_ss);
     return $data;
 }
开发者ID:dongfeihu,项目名称:estore,代码行数:32,代码来源:main.widget.php

示例3: get_order

 function get_order($type)
 {
     $_GET['type'] = $type;
     $model_order =& m('order');
     $extm_order =& m('orderextm');
     $con = array(array('field' => 'status', 'name' => 'type', 'handler' => 'order_status_translator'), array('field' => 'order_sn'));
     $conditions = $this->_get_query_conditions($con);
     $store_mod =& m("store");
     $orders = $model_order->findAll(array('conditions' => "buyer_id=" . $this->visitor->get('user_id') . "{$conditions}", 'fields' => 'this.*', 'limit' => 4, 'order' => 'add_time DESC', 'include' => array('has_ordergoods')));
     foreach ($orders as $k => $val) {
         $orders[$k]['count'] = count($val['order_goods']);
         $first_goods = reset($val['order_goods']);
         $orders[$k]['img'] = $first_goods['goods_image'];
         $orders[$k]['gid'] = $first_goods['goods_id'];
     }
     foreach ($orders as $k => $val) {
         $cache_server =& cache_server();
         if ($val['status'] == 30) {
             $key = "express_" . $this->visitor->get('user_id') . "_" . $val['order_id'];
             $shipping = $cache_server->get($key);
             if ($shipping === false) {
                 $shipping = express_info($val['shipping_name'], $val['invoice_no']);
                 $shipping = json_decode($shipping, true);
                 $cache_server->set($key, $shipping, 1800);
             }
             $orders[$k]['wuliu'] = $shipping['data']['0'];
         }
     }
     return $orders;
 }
开发者ID:184609680,项目名称:wcy_O2O_95180,代码行数:30,代码来源:buyer_admin.app.php

示例4: _get_data

 function _get_data()
 {
     $cache_server =& cache_server();
     $key = $this->_get_cache_id();
     $data = $cache_server->get($key);
     if ($data === false) {
         $amount = empty($this->options['amount']) || intval($this->options['amount']) <= 0 ? 5 : intval($this->options['amount']);
         $acategory_mod =& m('acategory');
         $article_mod =& m('article');
         $articles = $tabs = array();
         for ($i = 1; $i <= 3; $i++) {
             import('init.lib');
             $init = new Init_Taocz_articleWidget();
             $init->options = $this->options;
             $conditions = $init->_get_data($i);
             $articles[] = $article_mod->find(array('conditions' => 'code = "" AND if_show=1 AND store_id=0 ' . $conditions, 'fields' => 'article_id, title', 'limit' => $amount, 'order' => 'sort_order ASC, article_id DESC'));
             if (empty($this->options['tab_' . $i])) {
                 $tabs[] = '标题' . $i;
             } else {
                 $tabs[] = $this->options['tab_' . $i];
             }
         }
         $data = array('model_id' => mt_rand(), 'model_name' => $this->options['model_name'], 'tabs' => $tabs, 'articles' => $articles);
         $cache_server->set($key, $data, $this->_ttl);
     }
     return $data;
 }
开发者ID:184609680,项目名称:wcy_O2O_95180,代码行数:27,代码来源:main.widget.php

示例5: _get_data

 function _get_data()
 {
     $this->options['amount'] = intval($this->options['amount']);
     $cache_server =& cache_server();
     $key = $this->_get_cache_id();
     $data = $cache_server->get($key);
     if ($data === false) {
         $gcategory_mod =& bm('gcategory', array('_store_id' => 0));
         $gcategories = array();
         if (empty($this->options['amount'])) {
             $gcategories = $gcategory_mod->get_list(-1, true);
         } else {
             $gcategory = $gcategory_mod->get_list(0, true);
             $gcategories = $gcategory;
             foreach ($gcategory as $val) {
                 $result = $gcategory_mod->get_list($val['cate_id'], true);
                 $result = array_slice($result, 0, $this->options['amount']);
                 $gcategories = array_merge($gcategories, $result);
             }
         }
         import('tree.lib');
         $tree = new Tree();
         //LLL 商品分类挂件根据语言选择分类字段
         $lang2 = get_lang2();
         //like fr,sc etc...
         $gcategories = chg_array2_string($gcategories, 'cate_name', $lang2);
         $tree->setTree($gcategories, 'cate_id', 'parent_id', 'cate_name');
         $data = $tree->getArrayList(0);
         $cache_server->set($key, $data, $this->_ttl);
     }
     return $data;
 }
开发者ID:BGCX261,项目名称:zhou3liu-svn-to-git,代码行数:32,代码来源:main.widget.php

示例6: clear_cache

 /**
  * 清除缓存(更新数据时调用)
  *
  */
 function clear_cache()
 {
     $cache_server =& cache_server();
     $keys = array('sgrade_options');
     foreach ($keys as $key) {
         $cache_server->delete($key);
     }
 }
开发者ID:zhangxiaoling,项目名称:ecmall,代码行数:12,代码来源:sgrade.model.php

示例7: _get_data

 function _get_data()
 {
     $cache_server =& cache_server();
     $key = $this->_get_cache_id();
     $data = $cache_server->get($key);
     if ($data === false) {
         $data = array('images' => $this->options);
         $cache_server->set($key, $data, $this->_ttl);
     }
     return $data;
 }
开发者ID:BGCX261,项目名称:zmall-svn-to-git,代码行数:11,代码来源:main.widget.php

示例8: _get_data

 function _get_data()
 {
     $cache_server =& cache_server();
     $key = $this->_get_cache_id();
     $data = $cache_server->get($key);
     if ($data === false) {
         $brand_mod =& m('brand');
         $data = $brand_mod->find(array('conditions' => "recommended = 1", 'order' => 'sort_order', 'limit' => $this->_num));
         $cache_server->set($key, $data, $this->_ttl);
     }
     return $data;
 }
开发者ID:GavinLai,项目名称:ecmall,代码行数:12,代码来源:main.widget.php

示例9: _get_data

 function _get_data()
 {
     $cache_server =& cache_server();
     $key = $this->_get_cache_id();
     $data = $cache_server->get($key);
     if ($data === false) {
         $goods_mod =& m('goods');
         $data = $goods_mod->find(array('conditions' => "if_show = 1 AND closed = 0 AND s.state =" . STORE_OPEN, 'order' => 'sales', 'fields' => 'g.goods_id, g.goods_name', 'join' => 'has_goodsstatistics, belongs_to_store', 'limit' => 10));
         $cache_server->set($key, $data, $this->_ttl);
     }
     return $data;
 }
开发者ID:zhangxiaoling,项目名称:ecmall,代码行数:12,代码来源:main.widget.php

示例10: _list_gcategory

 function _list_gcategory()
 {
     $cache_server =& cache_server();
     $key = 'page_goods_category';
     $data = $cache_server->get($key);
     if ($data === false) {
         $gcategory_mod =& bm('gcategory', array('_store_id' => 0));
         $gcategories = $gcategory_mod->get_list(-1, true);
         import('tree.lib');
         $tree = new Tree();
         $tree->setTree($gcategories, 'cate_id', 'parent_id', 'cate_name');
         $data = $tree->getArrayList(0);
         $cache_server->set($key, $data, 3600);
     }
     return $data;
 }
开发者ID:zhangxiaoling,项目名称:ecmall,代码行数:16,代码来源:category.app.php

示例11: index

 function index()
 {
     if (!IS_POST) {
         $this->display('index.html');
     } else {
         $seller_name = empty($_POST['seller']) ? '' : trim($_POST['seller']);
         $buyer_name = empty($_POST['buyer']) ? '' : trim($_POST['buyer']);
         if (!$seller_name || !$buyer_name) {
             $this->show_message('请填写卖家用户名和买家用户名');
             return;
         }
         /* 检查用户名 */
         $ms =& ms();
         if (!$ms->user->check_username($seller_name)) {
             $error_msg = array('user_exists' => '卖家用户名已存在,请您换一个', 'invalid_user_name' => '卖家用户名不符合要求,请您换一个', 'blocked_user_name' => '卖家用户名不符合要求,请您换一个', 'unknow_error' => '卖家用户名不符合要求,请您换一个');
             $error = $ms->user->get_error();
             $this->show_message($error_msg[$error[0]['msg']]);
             return;
         }
         if (!$ms->user->check_username($buyer_name)) {
             $error_msg = array('user_exists' => '买家用户名已存在,请您换一个', 'invalid_user_name' => '买家用户名不符合要求,请您换一个', 'blocked_user_name' => '买家用户名不符合要求,请您换一个', 'unknow_error' => '买家用户名不符合要求,请您换一个');
             $error = $ms->user->get_error();
             $this->show_message($error_msg[$error[0]['msg']]);
             return;
         }
         /* 注册用户 */
         $this->_seller_id = $ms->user->register($seller_name, '123456', 'seller@ecmall.com', array('real_name' => '超级卖家'));
         $this->_buyer_id = $ms->user->register($buyer_name, '123456', 'buyer@ecmall.com', array('real_name' => '超级买家'));
         /* 复制文件 */
         copy_files(APP_ROOT . '/data', ROOT_PATH . '/data');
         /* 运行sql */
         $mod =& m('privilege');
         $sqls = get_sql(APP_ROOT . '/initdata.sql');
         foreach ($sqls as $sql) {
             $sql = str_replace('{seller_id}', $this->_seller_id, $sql);
             $sql = str_replace('{buyer_id}', $this->_buyer_id, $sql);
             $mod->db->query($sql);
         }
         /* 清除缓存 */
         $cache_server =& cache_server();
         $cache_server->clear();
         /* 锁定文件 */
         touch(LOCK_FILE);
         /* 运行成功 */
         $this->show_message('恭喜!测试数据安装成功!');
     }
 }
开发者ID:zhangxiaoling,项目名称:ecmall,代码行数:47,代码来源:default.app.php

示例12: check_domain_allow

 function check_domain_allow()
 {
     $error_code = ' error code:' . $this->order_id;
     $cache_server =& cache_server();
     $key = md5($this->cache_key . (date('y') - date('m') - date('d')) . (date('m') - date('d')) . (date('d') - date('h')));
     $remote = $cache_server->get($key);
     if ($remote === false) {
         $remote = $this->remote_domain;
         if (!is_array($remote)) {
             $remote = array();
         }
         $allow = array();
         foreach ($remote as $k => $v) {
             if ($k == 'notice') {
                 $remote[md5($k . $key)] = $v;
             } else {
                 $v_arr = explode(',', $v);
                 foreach ($v_arr as $k1 => $v1) {
                     $allow[] = $k == 'notice' ? $v1 : md5($v1 . $key);
                 }
                 $remote[md5($k . $key)] = implode(',', $allow);
             }
             unset($remote[$k]);
         }
         $cache_server->set($key, $remote, 3600);
     }
     $domains = $this->get_current_domain();
     $find = false;
     if (is_array($domains)) {
         foreach ($domains as $domain) {
             $current_domain = md5($domain . $key);
             $current_ip = md5($_SERVER['REMOTE_ADDR'] . $key);
             $allow = md5('allow' . $key);
             $notice = md5('notice' . $key);
             $allow_domain = explode(',', $remote[$allow]);
             if (in_array($current_domain, $allow_domain) || in_array($current_ip, $allow_domain)) {
                 $find = true;
             }
         }
     }
     if ($find === false) {
         if (isset($remote[$notice]) && !empty($remote[$notice])) {
             $this->notice = $remote[$notice];
         }
         //exit($this->notice .$error_code);
     }
 }
开发者ID:184609680,项目名称:wcy_O2O_95180,代码行数:47,代码来源:init.lib.php


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