本文整理汇总了PHP中dkcache函数的典型用法代码示例。如果您正苦于以下问题:PHP dkcache函数的具体用法?PHP dkcache怎么用?PHP dkcache使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dkcache函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dropCache
/**
* 删除缓存数据
*/
public function dropCache()
{
$this->cachedData = null;
$this->gcForCacheModel = null;
dkcache('gc_class');
dkcache('all_categories');
}
示例2: clearOp
/**
* 清理缓存
*/
public function clearOp()
{
if (!chksubmit()) {
Tpl::showpage('cache.clear');
return;
}
$lang = Language::getLangContent();
// 清理所有缓存
if ($_POST['cls_full'] == 1) {
foreach ($this->cacheItems as $i) {
dkcache($i);
}
// 表主键
Model::dropTablePkArrayCache();
// 商品分类
dkcache('gc_class');
dkcache('all_categories');
dkcache('goods_class_seo');
dkcache('class_tag');
// 广告
Model('adv')->makeApAllCache();
// 首页
Model('web_config')->getWebHtml('index', 1);
delCacheFile('index');
} else {
$todo = (array) $_POST['cache'];
foreach ($this->cacheItems as $i) {
if (in_array($i, $todo)) {
dkcache($i);
}
}
// 表主键
if (in_array('table', $todo)) {
Model::dropTablePkArrayCache();
}
// 商品分类
if (in_array('goodsclass', $todo)) {
dkcache('gc_class');
dkcache('all_categories');
dkcache('goods_class_seo');
dkcache('class_tag');
}
// 广告
if (in_array('adv', $todo)) {
Model('adv')->makeApAllCache();
}
// 首页
if (in_array('index', $todo)) {
Model('web_config')->getWebHtml('index', 1);
delCacheFile('index');
}
}
$this->log(L('cache_cls_operate'));
showMessage($lang['cache_cls_ok']);
}
示例3: ajaxOp
/**
* ajax操作
*/
public function ajaxOp()
{
switch ($_GET['branch']) {
case 'state':
$model_brand = Model('express');
$update_array = array();
$update_array['id'] = intval($_GET['id']);
$update_array[$_GET['column']] = trim($_GET['value']);
$model_brand->update($update_array);
dkcache('express');
$this->log(L('nc_edit,express_name,express_state') . '[ID:' . intval($_GET['id']) . ']', 1);
echo 'true';
exit;
break;
case 'order':
$_GET['value'] = $_GET['value'] == 0 ? 2 : 1;
$model_brand = Model('express');
$update_array = array();
$update_array['id'] = intval($_GET['id']);
$update_array[$_GET['column']] = trim($_GET['value']);
$model_brand->update($update_array);
dkcache('express');
$this->log(L('nc_edit,express_name,express_state') . '[ID:' . intval($_GET['id']) . ']', 1);
echo 'true';
exit;
break;
case 'e_zt_state':
$model_brand = Model('express');
$update_array = array();
$update_array['id'] = intval($_GET['id']);
$update_array[$_GET['column']] = trim($_GET['value']);
$model_brand->update($update_array);
dkcache('express');
$this->log(L('nc_edit,express_name,express_state') . '[ID:' . intval($_GET['id']) . ']', 1);
echo 'true';
exit;
break;
}
dkcache('express');
}
示例4: updateSetting
/**
* 更新信息
*
* @param array $param 更新数据
* @return bool 布尔类型的返回结果
*/
public function updateSetting($param)
{
if (empty($param)) {
return false;
}
if (is_array($param)) {
foreach ($param as $k => $v) {
$tmp = array();
$specialkeys_arr = array('statistics_code');
$tmp['value'] = in_array($k, $specialkeys_arr) ? htmlentities($v, ENT_QUOTES) : $v;
$where = " name = '" . $k . "'";
$result = Db::update('setting', $tmp, $where);
if ($result !== true) {
return $result;
}
}
dkcache('setting');
return true;
} else {
return false;
}
}
示例5: update_cacheOp
/**
* 更新圈子成员等级缓存
*/
public function update_cacheOp()
{
dkcache('circle_level');
showMessage(L('nc_common_op_succ'), 'index.php?act=circle_memberlevel');
}
示例6: dropCachedData
/**
* 删除缓存
*
* @param string $key 缓存键
*/
public function dropCachedData($key)
{
unset($this->cachedData[$key]);
dkcache($key);
}
示例7: store_grade_delOp
/**
* 删除等级
*/
public function store_grade_delOp()
{
/**
* 读取语言包
*/
$lang = Language::getLangContent();
$model_grade = Model('store_grade');
if (intval($_GET['sg_id']) > 0) {
//判断是否默认等级,默认等级不能删除
if ($_GET['sg_id'] == 1) {
//showMessage('默认等级不能删除 ','index.php?act=store_grade&op=store_grade');
showMessage($lang['default_store_grade_no_del'], 'index.php?act=store_grade&op=store_grade');
}
//判断该等级下是否存在店铺,存在的话不能删除
if (!$this->isable_delGrade(intval($_GET['sg_id']))) {
showMessage($lang['del_gradehavestore'], 'index.php?act=store_grade&op=store_grade');
}
/**
* 删除分类
*/
$model_grade->del(intval($_GET['sg_id']));
dkcache('store_grade');
$this->log(L('nc_del,store_grade') . '[ID:' . intval($_GET['sg_id']) . ']', 1);
showMessage($lang['nc_common_del_succ'], 'index.php?act=store_grade&op=store_grade');
} else {
showMessage($lang['nc_common_del_fail'], 'index.php?act=store_grade&op=store_grade');
}
}
示例8: rec_edit_saveOp
//.........这里部分代码省略.........
} else {
showMessage(Language::get('param_error'));
}
} elseif ($_POST['rec_type'] == 2 && $_POST['pic_type'] == 1) {
//本地图片上传
if (is_array($_FILES['pic']['tmp_name'])) {
foreach ($_FILES['pic']['tmp_name'] as $k => $v) {
//未上传新图的,还用老图
if (empty($v) && !empty($_POST['opic'][$k])) {
$array['body'][$k]['title'] = str_ireplace(UPLOAD_SITE_URL . '/', '', $_POST['opic'][$k]);
$array['body'][$k]['url'] = preg_match($pattern, $_POST['urlup'][$k]) ? $_POST['urlup'][$k] : '';
}
$ext = strtolower(pathinfo($_FILES['pic']['name'][$k], PATHINFO_EXTENSION));
if (in_array($ext, array('jpg', 'jpeg', 'gif', 'png', 'bmp'))) {
$filename = substr(md5(microtime(true)), 0, 16) . rand(100, 999) . $k . '.' . $ext;
if ($_FILES['pic']['size'][$k] < 1024 * 1024) {
move_uploaded_file($v, BASE_UPLOAD_PATH . '/' . ATTACH_REC_POSITION . '/' . $filename);
}
if ($_FILES['pic']['error'][$k] != 0) {
showMessage(Language::get('nc_common_save_fail'));
}
//删除老图
$old_file = str_ireplace(array(UPLOAD_SITE_URL, '..'), array(BASE_UPLOAD_PATH, ''), $_POST['opic'][$k]);
if (is_file($old_file)) {
@unlink($old_file);
}
$array['body'][$k]['title'] = ATTACH_REC_POSITION . '/' . $filename;
$array['body'][$k]['url'] = preg_match($pattern, $_POST['urlup'][$k]) ? $_POST['urlup'][$k] : '';
$data['pic_type'] = 1;
}
}
//最后删除数据库里有但没有POST过来的图片
$model = Model('rec_position');
$oinfo = $model->where(array('rec_id' => $_POST['rec_id']))->find();
$oinfo = unserialize($oinfo['content']);
foreach ($oinfo['body'] as $k => $v) {
if (!in_array(UPLOAD_SITE_URL . '/' . $v['title'], (array) $_POST['opic'])) {
if (is_file(BASE_UPLOAD_PATH . '/' . $v['title'])) {
@unlink(BASE_UPLOAD_PATH . '/' . $v['title']);
}
}
}
unset($oinfo);
}
//如果是上传图片,则取原图片地址
if (empty($array)) {
if (is_array($_POST['opic'])) {
foreach ($_POST['opic'] as $k => $v) {
$array['body'][$k]['title'] = $v;
$array['body'][$k]['url'] = preg_match($pattern, $_POST['urlup'][$k]) ? $_POST['urlup'][$k] : '';
}
}
}
} elseif ($_POST['rec_type'] == 2 && $_POST['pic_type'] == 2) {
//远程图片
if (is_array($_POST['pic'])) {
foreach ($_POST['pic'] as $k => $v) {
if (!preg_match("/^(http\\:\\/\\/)/i", $v)) {
continue;
}
$ext = strtolower(pathinfo($v, PATHINFO_EXTENSION));
if (in_array($ext, array('jpg', 'jpeg', 'gif', 'png', 'bmp'))) {
$c = count($array['body']);
$array['body'][$c]['title'] = $v;
$array['body'][$c]['url'] = preg_match($pattern, $_POST['urlremote'][$k]) ? $_POST['urlremote'][$k] : '';
$data['pic_type'] = 2;
}
}
}
} else {
showMessage(Language::get('param_error'));
}
if ($_POST['rec_type'] != 1) {
$array['width'] = is_numeric($_POST['rwidth']) ? $_POST['rwidth'] : '';
$array['height'] = is_numeric($_POST['rheight']) ? $_POST['rheight'] : '';
}
$array['target'] = intval($_POST['rtarget']);
$data['title'] = $_POST['rtitle'];
$data['content'] = serialize($array);
$model = Model('rec_position');
//如果是把本地上传类型改为文字或远程,则先取出原来上传的图片路径,待update成功后,再删除这些图片
if ($_POST['opic_type'] == 1 && ($_POST['pic_type'] == 2 || $_POST['rec_type'] == 1)) {
$oinfo = $model->where(array('rec_id' => $_POST['rec_id']))->find();
$oinfo = unserialize($oinfo['content']);
}
$result = $model->where(array('rec_id' => $_POST['rec_id']))->update($data);
if ($result) {
if ($oinfo) {
foreach ($oinfo['body'] as $v) {
if (is_file(BASE_UPLOAD_PATH . '/' . $v['title'])) {
@unlink(BASE_UPLOAD_PATH . '/' . $v['title']);
}
}
}
dkcache("rec_position/{$_POST['rec_id']}");
showMessage(Language::get('nc_common_save_succ'), 'index.php?act=rec_position&op=rec_list');
} else {
showMessage(Language::get('nc_common_save_fail'), 'index.php?act=rec_position&op=rec_list');
}
}
示例9: dropCachedOwnShopIds
/**
* 删除缓存自营店铺的ID
*/
public function dropCachedOwnShopIds()
{
$this->ownShopIds = null;
dkcache('own_shop_ids');
}
示例10: slider_clearOp
/**
* 幻灯片清空
*/
public function slider_clearOp()
{
$model_setting = Model('setting');
$update = array();
$update['live_pic1'] = '';
$update['live_link1'] = '';
$update['live_pic2'] = '';
$update['live_link2'] = '';
$update['live_pic3'] = '';
$update['live_link3'] = '';
$update['live_pic4'] = '';
$update['live_link4'] = '';
$res = $model_setting->updateSetting($update);
if ($res) {
dkcache('setting');
$this->log('清空抢购幻灯片设置', 1);
echo json_encode(array('result' => 'true'));
} else {
echo json_encode(array('result' => 'false'));
}
exit;
}
示例11: dropCache
/**
* 删除缓存数据
*/
public function dropCache()
{
$this->cachedData = null;
dkcache('area');
}
示例12: dropTablePkArrayCache
/**
* 删除表主键缓存
*/
public static function dropTablePkArrayCache()
{
dkcache('field/_pk');
}
示例13: rec_edit_saveOp
//.........这里部分代码省略.........
if (in_array($ext, array('jpg', 'jpeg', 'gif', 'png'))) {
$filename = substr(md5(microtime(true)), 0, 16) . rand(100, 999) . '.' . $ext;
if ($_FILES['article_pic']['size'] < 1024 * 1024) {
move_uploaded_file($_FILES['article_pic']['tmp_name'], BASE_UPLOAD_PATH . '/' . ATTACH_REC_POSITION . '/' . $filename);
}
if ($_FILES['article_pic']['error'] != 0) {
showMessage(Language::get('nc_common_op_fail'));
}
}
}
$array['body']['targetid'] = $_REQUEST['article_id'];
$array['body']['contenttype'] = 'sms_article';
$array['body']['imageurl'] = $filename;
$array['body']['requesturl'] = '/cms/index.php?act=article&op=article_detail&article_id=' . $_REQUEST['article_id'];
//$array['width'] = is_numeric($_POST['rwidth']) ? $_POST['rwidth'] : '';
//$array['height'] = is_numeric($_POST['rheight']) ? $_POST['rheight'] : '';
$array['body']['cat_id'] = $_REQUEST['article_class'];
//}
//if (empty($array)) showMessage(Language::get('param_error'));
$data['content'] = serialize($array);
} else {
if ($_POST['rec_type'] == 2 && $_POST['pic_type'] == 3) {
//showMessage(Language::get('param_error'));
} else {
if ($_POST['rec_type'] == 2 && $_POST['pic_type'] == 4) {
//平台活动
if (empty($_FILES['actiity_pic']['name'])) {
$filename = $_REQUEST['default_img'];
} else {
$ext = strtolower(pathinfo($_FILES['actiity_pic']['name'], PATHINFO_EXTENSION));
if (in_array($ext, array('jpg', 'jpeg', 'gif', 'png'))) {
$filename = substr(md5(microtime(true)), 0, 16) . rand(100, 999) . '.' . $ext;
if ($_FILES['actiity_pic']['size'] < 1024 * 1024) {
move_uploaded_file($_FILES['actiity_pic']['tmp_name'], BASE_UPLOAD_PATH . '/' . ATTACH_REC_POSITION . '/' . $filename);
}
if ($_FILES['actiity_pic']['error'] != 0) {
showMessage(Language::get('nc_common_op_fail'));
}
}
}
if ($_REQUEST['activity_type'] == 'pf_goods') {
$activity = Model('activity');
//$act_condition['field']='item_id';
$act_condition['opening'] = true;
$act_condition['activity_id'] = $_POST['activity_id'];
$act_list = $activity->getJoinList($act_condition);
$array1 = array();
foreach ($act_list as $key => $value) {
$array1[] = $value['item_id'];
}
$string = implode(',', $array1);
$array['body']['imageurl'] = $filename;
$array['body']['contenttype'] = 'pf_goods';
$array['body']['targetid'] = $_REQUEST['activity_id'];
$array['body']['goodsid'] = $string;
$array['body']['requesturl'] = PG_R_PATH;
} else {
$array['body']['title'] = $_REQUEST['ad_title'];
//$array['body']['imageurl'] = ATTACH_REC_POSITION.'/'.$_SESSION['store_id'].'/'.$filename;
$array['body']['imageurl'] = $filename;
$array['body']['requesturl'] = '/mobile/index.php?act=activity&op=sa_datail&activity_id=' . $_REQUEST['activity_id'];
$array['body']['targetid'] = $_REQUEST['activity_id'];
$array['body']['contenttype'] = $_REQUEST['activity_type'];
}
$data['content'] = serialize($array);
}
}
}
$data['pic_type'] = $_POST['rec_type'];
$data['pic_width'] = $_POST['rwidth'];
$data['pic_height'] = $_POST['rheight'];
$data['rec_app'] = $_POST['rec_app'];
$data['rec_state'] = $_POST['rec_state'];
$data['rec_start_time'] = strtotime($_POST['stime']);
$data['rec_stop_time'] = strtotime($_POST['etime']);
$data['rec_position'] = $_POST['rec_position'];
$data['rec_content_type'] = $_POST['pic_type'];
$array['target'] = intval($_POST['rtarget']);
$data['title'] = $_POST['rtitle'];
$model = Model('rec_position');
//如果是把本地上传类型改为文字或远程,则先取出原来上传的图片路径,待update成功后,再删除这些图片
if ($_POST['opic_type'] == 1 && ($_POST['pic_type'] == 2 || $_POST['rec_type'] == 1)) {
$oinfo = $model->where(array('rec_id' => $_POST['rec_id']))->find();
$oinfo = unserialize($oinfo['content']);
}
$result = $model->where(array('rec_id' => $_POST['rec_id']))->update($data);
if ($result) {
if ($oinfo) {
foreach ($oinfo['body'] as $v) {
if (is_file(BASE_UPLOAD_PATH . '/' . $v['title'])) {
@unlink(BASE_UPLOAD_PATH . '/' . $v['title']);
}
}
}
dkcache("rec_position/{$_POST['rec_id']}");
showMessage(Language::get('nc_common_save_succ'), 'index.php?act=rec_position&op=rec_list');
} else {
showMessage(Language::get('nc_common_save_fail'), 'index.php?act=rec_position&op=rec_list');
}
}
示例14: ajaxOp
/**
* ajax操作
*/
public function ajaxOp()
{
switch ($_GET['branch']) {
/**
* 页面导航 排序
*/
case 'nav_sort':
$model_navigation = Model('navigation');
$update_array = array();
$update_array['nav_id'] = intval($_GET['id']);
$update_array[$_GET['column']] = trim($_GET['value']);
$result = $model_navigation->update($update_array);
dkcache('nav');
echo 'true';
exit;
break;
}
}
示例15: dropApCacheByAdvIds
/**
* 删除缓存
*/
public function dropApCacheByAdvIds($advIds)
{
$apIds = array_keys((array) Model()->table('adv')->field('ap_id')->where(array('adv_id' => array('in', (array) $advIds)))->key('ap_id')->select());
foreach ($apIds as $apId) {
$apId = (int) $apId;
dkcache("adv/{$apId}");
}
}