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


PHP delcache函数代码示例

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


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

示例1: clear

 /**
  * 清除页面缓存
  */
 public function clear()
 {
     $list = array('WAP首页' => 'Wap:index');
     foreach ($list as $key => $val) {
         delcache($val);
     }
     $this->success('缓存删除完毕');
 }
开发者ID:8yong8,项目名称:vshop,代码行数:11,代码来源:CacheController.class.php

示例2: show


//.........这里部分代码省略.........
                 $result = $this->db->fetch_array($rs);
                 $total = $result[0]['count'];
                 $pages = ceil($total / $pagesize);
                 $start = 1;
             }
             $rs = $this->db->query("SELECT * FROM `{$table_name}` {$where} ORDER BY `id` {$order} LIMIT {$offset},{$pagesize}");
             $data = $this->db->fetch_array($rs);
             $tablename = $this->db->table_name . '_data';
             $this->url = pc_base::load_app_class('url');
             foreach ($data as $r) {
                 if ($r['islink']) {
                     continue;
                 }
                 $this->db->table_name = $tablename;
                 $r2 = $this->db->get_one(array('id' => $r['id']));
                 if ($r) {
                     $r = array_merge($r, $r2);
                 }
                 if ($r['upgrade']) {
                     $urls[1] = $r['url'];
                 } else {
                     $urls = $this->url->show($r['id'], '', $r['catid'], $r['inputtime']);
                 }
                 $this->html->show($urls[1], $r, 0, 'edit', $r['upgrade']);
             }
             if ($pages > $page) {
                 $page++;
                 $http_url = get_url();
                 $creatednum = $offset + count($data);
                 $percent = round($creatednum / $total, 2) * 100;
                 $message = L('need_update_items', array('total' => $total, 'creatednum' => $creatednum, 'percent' => $percent));
                 $forward = $start ? "?m=content&c=create_html&a=show&type={$type}&dosubmit=1&first={$first}&fromid={$fromid}&toid={$toid}&fromdate={$fromdate}&todate={$todate}&pagesize={$pagesize}&page={$page}&pages={$pages}&total={$total}&modelid={$modelid}" : preg_replace("/&page=([0-9]+)&pages=([0-9]+)&total=([0-9]+)/", "&page={$page}&pages={$pages}&total={$total}", $http_url);
             } else {
                 delcache('html_show_' . $_SESSION['userid'], 'content');
                 $message = L('create_update_success');
                 $forward = '?m=content&c=create_html&a=show';
             }
             showmessage($message, $forward, 200);
         } else {
             //当没有选择模型时,需要按照栏目来更新
             if (!isset($set_catid)) {
                 if ($catids[0] != 0) {
                     $update_url_catids = $catids;
                 } else {
                     foreach ($this->categorys as $catid => $cat) {
                         if ($cat['child'] || $cat['siteid'] != $this->siteid || $cat['type'] != 0) {
                             continue;
                         }
                         $setting = string2array($cat['setting']);
                         if (!$setting['content_ishtml']) {
                             continue;
                         }
                         $update_url_catids[] = $catid;
                     }
                 }
                 setcache('update_html_catid' . '-' . $this->siteid . '-' . $_SESSION['userid'], $update_url_catids, 'content');
                 $message = L('start_update');
                 $forward = "?m=content&c=create_html&a=show&set_catid=1&pagesize={$pagesize}&dosubmit=1";
                 showmessage($message, $forward, 200);
             }
             if (count($catids) == 1 && $catids[0] == 0) {
                 $message = L('create_update_success');
                 $forward = '?m=content&c=create_html&a=show';
                 showmessage($message, $forward, 200);
             }
             $catid_arr = getcache('update_html_catid' . '-' . $this->siteid . '-' . $_SESSION['userid'], 'content');
开发者ID:klj123wan,项目名称:czsz,代码行数:67,代码来源:create_html.php

示例3: export_database


//.........这里部分代码省略.........
         if (!isset($tables) || !is_array($tables)) {
             showmessage(L('select_tbl'));
         }
         $random = random(20, 'abcdefghigklmzopqrstuvwxyz0123456789');
         setcache('bakup_tables', $tables, 'commons');
     } else {
         if (!($tables = getcache('bakup_tables', 'commons'))) {
             showmessage(L('select_tbl'));
         }
     }
     if ($this->db->version() > '4.1') {
         if ($sqlcharset) {
             $this->db->query("SET NAMES '" . $sqlcharset . "';\n\n");
         }
         if ($sqlcompat == 'MYSQL40') {
             $this->db->query("SET SQL_MODE='MYSQL40'");
         } elseif ($sqlcompat == 'MYSQL41') {
             $this->db->query("SET SQL_MODE=''");
         }
     }
     $tabledump = '';
     $tableid = $tableid != '' ? $tableid - 1 : 0;
     $startfrom = $startfrom != '' ? intval($startfrom) : 0;
     for ($i = $tableid; $i < count($tables) && strlen($tabledump) < $sizelimit * 1000; $i++) {
         global $startrow;
         $offset = 100;
         if (!$startfrom) {
             if ($tables[$i] != DB_PRE . 'session') {
                 $tabledump .= "DROP TABLE IF EXISTS `{$tables[$i]}`;\n";
             }
             $createtable = $this->db->query("SHOW CREATE TABLE `{$tables[$i]}` ");
             $create = $this->db->fetch_next();
             $tabledump .= $create['Create Table'] . ";\n\n";
             $this->db->free_result($createtable);
             if ($sqlcompat == 'MYSQL41' && $this->db->version() < '4.1') {
                 $tabledump = preg_replace("/TYPE\\=([a-zA-Z0-9]+)/", "ENGINE=\\1 DEFAULT CHARSET=" . $dumpcharset, $tabledump);
             }
             if ($this->db->version() > '4.1' && $sqlcharset) {
                 $tabledump = preg_replace("/(DEFAULT)*\\s*CHARSET=[a-zA-Z0-9]+/", "DEFAULT CHARSET=" . $sqlcharset, $tabledump);
             }
             if ($tables[$i] == DB_PRE . 'session') {
                 $tabledump = str_replace("CREATE TABLE `" . DB_PRE . "session`", "CREATE TABLE IF NOT EXISTS `" . DB_PRE . "session`", $tabledump);
             }
         }
         $numrows = $offset;
         while (strlen($tabledump) < $sizelimit * 1000 && $numrows == $offset) {
             if ($tables[$i] == DB_PRE . 'session' || $tables[$i] == DB_PRE . 'member_cache') {
                 break;
             }
             $sql = "SELECT * FROM `{$tables[$i]}` LIMIT {$startfrom}, {$offset}";
             $numfields = $this->db->num_fields($sql);
             $numrows = $this->db->num_rows($sql);
             $fields_name = $this->db->get_fields($tables[$i]);
             $rows = $this->db->query($sql);
             $name = array_keys($fields_name);
             $r = array();
             while ($row = $this->db->fetch_next()) {
                 $r[] = $row;
                 $comma = "";
                 $tabledump .= "INSERT INTO `{$tables[$i]}` VALUES(";
                 for ($j = 0; $j < $numfields; $j++) {
                     $tabledump .= $comma . "'" . $this->db->escape($row[$name[$j]]) . "'";
                     $comma = ",";
                 }
                 $tabledump .= ");\n";
             }
             $this->db->free_result($rows);
             $startfrom += $offset;
         }
         $tabledump .= "\n";
         $startrow = $startfrom;
         $startfrom = 0;
     }
     if (trim($tabledump)) {
         $tabledump = "# phpcms bakfile\n# version:PHPCMS V9\n# time:" . date('Y-m-d H:i:s') . "\n# type:phpcms\n# phpcms:http://www.phpcms.cn\n# --------------------------------------------------------\n\n\n" . $tabledump;
         $tableid = $i;
         $filename = $random . '_' . $tabletype . '_' . date('Ymd') . '_' . $fileid . '.sql';
         $altid = $fileid;
         $fileid++;
         $bakfile_path = CACHE_PATH . 'bakup' . DIRECTORY_SEPARATOR . $this->pdo_name;
         if (!dir_create($bakfile_path)) {
             showmessage(L('dir_not_be_created'));
         }
         $bakfile = $bakfile_path . DIRECTORY_SEPARATOR . $filename;
         if (!is_writable(CACHE_PATH . 'bakup')) {
             showmessage(L('dir_not_be_created'));
         }
         file_put_contents($bakfile, $tabledump);
         @chmod($bakfile, 0777);
         if (!EXECUTION_SQL) {
             $filename = L('bundling') . $altid . '#';
         }
         showmessage(L('bakup_file') . " {$filename} " . L('bakup_write_succ'), '?m=admin&c=database&a=export&sizelimit=' . $sizelimit . '&sqlcompat=' . $sqlcompat . '&sqlcharset=' . $sqlcharset . '&tableid=' . $tableid . '&fileid=' . $fileid . '&startfrom=' . $startrow . '&random=' . $random . '&dosubmit=1&tabletype=' . $tabletype . '&allow=' . $allow . '&pdo_select=' . $this->pdo_name);
     } else {
         $bakfile_path = CACHE_PATH . 'bakup' . DIRECTORY_SEPARATOR . $this->pdo_name . DIRECTORY_SEPARATOR;
         file_put_contents($bakfile_path . 'index.html', '');
         delcache('bakup_tables', 'commons');
         showmessage(L('bakup_succ'), '?m=admin&c=database&a=import&pdoname=' . $this->pdo_name);
     }
 }
开发者ID:zhangjSir,项目名称:JinMaSite,代码行数:101,代码来源:database.php

示例4: delete

	/**
	 * 应用删除程序
	 */
	public function delete() {
		if(isset($_POST['dosubmit'])) {
			$pluginid = intval($_POST['pluginid']);
			$plugin_data =  $this->db->get_one(array('pluginid'=>$pluginid));
			$op_status = FALSE;	
			$dir = $plugin_data['dir'];
			$config_file = PC_PATH.'plugin'.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR.'plugin_'.$dir.'.cfg.php';	
			if(file_exists($config_file)) {
				$plugin_data = @require($config_file);
			}		
			$filename = PC_PATH.'plugin'.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR.$plugin_data['plugin']['uninstallfile'];
			if(file_exists($filename)) {
				@include_once $filename;
			} else {
				showmessage(L('plugin_lacks_uninstall_file','','plugin'),HTTP_REFERER);
			}
			if($op_status) {
				$this->db->delete(array('pluginid'=>$pluginid));
				$this->db_var->delete(array('pluginid'=>$pluginid));
				delcache($dir,'plugins');
				delcache($dir.'_var','plugins');
				$this->set_hook_cache();
				if($plugin_data['plugin']['iframe']) {
					pc_base::load_sys_func('dir');
					if(!dir_delete(PC_PATH.'plugin'.DIRECTORY_SEPARATOR.$dir)) {
						showmessage(L('plugin_uninstall_success_no_delete','','plugin'),'?m=zl_admin&c=plugin');
					}
				}
				showmessage(L('plugin_uninstall_success','','plugin'),'?m=zl_admin&c=plugin');
			} else {
				showmessage(L('plugin_uninstall_fail','','plugin'),'?m=zl_admin&c=plugin');
			}	
		} else {
			$show_header = 0;
			$pluginid = intval($_GET['pluginid']);
			$plugin_data =  $this->db->get_one(array('pluginid'=>$pluginid));
			include $this->admin_tpl('plugin_delete_confirm');			
		}

	}
开发者ID:panhongsheng,项目名称:zl_cms,代码行数:43,代码来源:plugin.php

示例5: public_create_type

 public function public_create_type()
 {
     $specialid = $_GET['specialid'] ? intval($_GET['specialid']) : 0;
     if (!$specialid) {
         showmessage(L('illegal_action'));
     }
     $page = isset($_GET['page']) ? intval($_GET['page']) : 1;
     $pages = isset($_GET['pages']) ? intval($_GET['pages']) : 0;
     $types = getcache('create_types', 'commons');
     if (is_array($types) && !empty($types) || $pages) {
         if (!isset($page) || $page == 1) {
             $typeids = array_keys($types);
             $typeid = array_shift($typeids);
             $typename = $types[$typeid];
             unset($types[$typeid]);
             setcache('create_types', $types, 'commons');
         }
         if (!$pages) {
             $c = pc_base::load_model('special_content_model');
             $result = $c->get_one(array('typeid' => $typeid), 'COUNT(*) AS total');
             $total = $result['total'];
             $pages = ceil($total / 20);
         }
         if ($_GET['typeid']) {
             $typeid = intval($_GET['typeid']);
             $typename = $_GET['typename'];
         }
         $maxpage = $page + 10;
         if ($maxpage > $pages) {
             $maxpage = $pages;
         }
         for ($page; $page <= $maxpage; $page++) {
             $html = pc_base::load_app_class('html');
             $html->create_type($typeid, $page);
         }
         if (empty($types) && $pages == $maxpage) {
             delcache('create_types', 'commons');
             showmessage($typename . L('type_update_success'), '?m=special&c=special&a=public_create_content&specialid=' . $specialid);
         }
         if ($pages <= $maxpage) {
             showmessage($typename . L('update_success'), '?m=special&c=special&a=public_create_type&specialid=' . $specialid);
         } else {
             showmessage($typename . L('type_from') . ($_GET['page'] ? $_GET['page'] : 1) . L('type_end') . $maxpage . '</font> ' . L('update_success'), '?m=special&c=special&a=public_create_type&typeid=' . $typeid . '&typename=' . $typename . '&page=' . $page . '&pages=' . $pages . '&specialid=' . $specialid);
         }
     } else {
         $special_api = pc_base::load_app_class('special_api');
         $types = $special_api->_get_types($specialid);
         setcache('create_types', $types, 'commons');
         showmessage(L('start_update_type'), '?m=special&c=special&a=public_create_type&specialid=' . $specialid);
     }
 }
开发者ID:cfhb,项目名称:MIS,代码行数:51,代码来源:special.php

示例6: _dlecache

 /**
  * 删除联动菜单缓存文件
  * @param init $linkageid
  */
 private function _dlecache($linkageid)
 {
     return delcache($linkageid, 'linkage');
 }
开发者ID:boylzj,项目名称:omguitar,代码行数:8,代码来源:linkage.php

示例7: export_database


//.........这里部分代码省略.........
         if (!isset($tables) || !is_array($tables)) {
             $this->showmessage('error', '请选择数据表', $res_url);
         }
         $random = mt_rand(1000, 9999);
         setcache('bakup_tables', $tables, 'commons');
     } else {
         if (!($tables = getcache('bakup_tables', 'commons'))) {
             $this->showmessage('error', '请选择数据表', $res_url);
         }
     }
     if ($this->db->version() > '4.1') {
         if ($sqlcharset) {
             $this->db->query("SET NAMES '" . $sqlcharset . "';\n\n");
         }
         if ($sqlcompat == 'MYSQL40') {
             $this->db->query("SET SQL_MODE='MYSQL40'");
         } elseif ($sqlcompat == 'MYSQL41') {
             $this->db->query("SET SQL_MODE=''");
         }
     }
     $tabledump = '';
     $tableid = $tableid != '' ? $tableid - 1 : 0;
     $startfrom = $startfrom != '' ? intval($startfrom) : 0;
     for ($i = $tableid; $i < count($tables) && strlen($tabledump) < $sizelimit * 1000; $i++) {
         global $startrow;
         $offset = 100;
         if (!$startfrom) {
             if ($tables[$i] != $dbprefix . 'session') {
                 $tabledump .= "DROP TABLE IF EXISTS `{$tables[$i]}`;\n";
             }
             $createtable = $this->db->query("SHOW CREATE TABLE `{$tables[$i]}` ");
             $res = $this->db->query("SHOW CREATE TABLE {$tables[$i]}")->result_array();
             $tabledump .= $res[0]['Create Table'] . ";\n\n";
             if ($sqlcompat == 'MYSQL41' && $this->db->version() < '4.1') {
                 $tabledump = preg_replace("/TYPE\\=([a-zA-Z0-9]+)/", "ENGINE=\\1 DEFAULT CHARSET=" . $dumpcharset, $tabledump);
             }
             if ($this->db->version() > '4.1' && $sqlcharset) {
                 $tabledump = preg_replace("/(DEFAULT)*\\s*CHARSET=[a-zA-Z0-9]+/", "DEFAULT CHARSET=" . $sqlcharset, $tabledump);
             }
             if ($tables[$i] == $dbprefix . 'session') {
                 $tabledump = str_replace("CREATE TABLE `" . $dbprefix . "session`", "CREATE TABLE IF NOT EXISTS `" . $dbprefix . "session`", $tabledump);
             }
         }
         $numrows = $offset;
         while (strlen($tabledump) < $sizelimit * 1000 && $numrows == $offset) {
             if ($tables[$i] == $dbprefix . 'session' || $tables[$i] == $dbprefix . 'member_cache') {
                 break;
             }
             $sql = "SELECT * FROM `{$tables[$i]}` LIMIT {$startfrom}, {$offset}";
             $numfields = $this->db->query($sql)->num_fields();
             //字段个数
             $numrows = $this->db->query($sql)->num_rows();
             //数据条数
             $fields_name = $this->db->list_fields($tables[$i]);
             //字段名称
             $rows_list = $this->db->query($sql)->result_array();
             foreach ($rows_list as $v) {
                 $comma = "";
                 $tabledump .= "INSERT INTO `{$tables[$i]}` VALUES(";
                 for ($j = 0; $j < $numfields; $j++) {
                     $tabledump .= $comma . "'" . mysql_escape_string($v[$fields_name[$j]]) . "'";
                     $comma = ",";
                 }
                 $tabledump .= ");\n";
             }
             $startfrom += $offset;
         }
         $tabledump .= "\n";
         $startrow = $startfrom;
         $startfrom = 0;
     }
     $cache_path = FCPATH . 'caches' . DIRECTORY_SEPARATOR;
     $pdo_name = $this->db->database;
     if (trim($tabledump)) {
         $tabledump = "# wmmall bakfile\n# version:MVMALL V1\n# time:" . date('Y-m-d H:i:s') . "\n# type:wmmall\n# \n# --------------------------------------------------------\n\n\n" . $tabledump;
         $tableid = $i;
         $filename = $tabletype . '_' . date('Ymd') . '_' . $random . '_' . $fileid . '.sql';
         $altid = $fileid;
         $fileid++;
         $bakfile_path = $cache_path . 'bakup' . DIRECTORY_SEPARATOR . $pdo_name;
         $this->load->library('ifile_lib');
         if (!$this->ifile_lib->is_dir_exists($bakfile_path)) {
             $this->ifile_lib->mkdir($bakfile_path);
         }
         $bakfile = $bakfile_path . DIRECTORY_SEPARATOR . $filename;
         if (!is_writable($cache_path . 'bakup')) {
             $this->showmessage('error', '目录无法写入文件', $res_url);
         }
         file_put_contents($bakfile, $tabledump);
         @chmod($bakfile, 0777);
         $filename = '分卷:' . $altid . '#写入成功';
         $next_url = $this->admin_url . 'system/dbsave/export?dosubmit=1&sizelimit=' . $sizelimit . '&sqlcompat=' . $sqlcompat . '&sqlcharset=' . $sqlcharset . '&tableid=' . $tableid . '&fileid=' . $fileid . '&startfrom=' . $startrow . '&random=' . $random . '&dosubmit=1&tabletype=' . $tabletype . '&pdo_select=' . $pdo_name . '&loghash=' . $this->session->userdata('loghash');
         $this->showmessage('success', $filename, $next_url);
     } else {
         $bakfile_path = $cache_path . 'bakup' . DIRECTORY_SEPARATOR . $pdo_name . DIRECTORY_SEPARATOR;
         file_put_contents($bakfile_path . 'index.html', '');
         delcache('bakup_tables', 'commons');
         $this->showmessage('success', '数据备份完成!', $this->admin_url . 'maintenance/dbsave/import?loghash=' . $this->session->userdata('loghash'));
     }
 }
开发者ID:zydj333,项目名称:hualiangcaifu,代码行数:101,代码来源:dbsave.php

示例8: opendir

{
  $handle = opendir($dir);
  while (false!==($FolderOrFile = readdir($handle)))
  {
     if($FolderOrFile != "." && $FolderOrFile != "..")
     { 
       if(is_dir("$dir/$FolderOrFile"))
       { deldir("$dir/$FolderOrFile"); }  // recursive
       else
       { unlink("$dir/$FolderOrFile"); }
     } 
  }
} 

if($delete != "") {
	delcache($cachefolder);
}

$cacheSize = getTotalSize($cachefolder);

?>
<a href="<?php 
echo $HTTP_SERVER['PHP_SELF'];
?>
">[Refresh]</a><br><br>
Total size of cache folder: <B><?php 
echo $cacheSize / 1000000;
?>
 Mb.</B> (<?php 
echo $cacheSize;
?>
开发者ID:bjornbjorn,项目名称:phpODP,代码行数:31,代码来源:delcache.php

示例9: setStatus

 function setStatus()
 {
     $addon = I('addonname');
     $token_status = D('Common/AddonStatus')->getList();
     if ($token_status[$addon] === '-1') {
         $this->success('无权限设置');
     }
     $status = 1 - I('status');
     $res = D('Common/AddonStatus')->set($addon, $status);
     delcache();
     $this->success('设置成功');
 }
开发者ID:LukeChow1018,项目名称:weixin,代码行数:12,代码来源:IndexController.class.php


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