本文整理汇总了PHP中Dir::del方法的典型用法代码示例。如果您正苦于以下问题:PHP Dir::del方法的具体用法?PHP Dir::del怎么用?PHP Dir::del使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dir
的用法示例。
在下文中一共展示了Dir::del方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: qclear
public function qclear()
{
$obj_dir = new Dir();
is_dir(DATA_PATH . '_fields/') && $obj_dir->del(DATA_PATH . '_fields/');
is_dir(CACHE_PATH) && $obj_dir->delDir(CACHE_PATH);
is_dir(DATA_PATH) && $obj_dir->del(DATA_PATH);
is_dir(TEMP_PATH) && $obj_dir->delDir(TEMP_PATH);
is_dir(LOG_PATH) && $obj_dir->delDir(LOG_PATH);
is_dir(PIN_DATA_PATH . '/static/') && $obj_dir->del(PIN_DATA_PATH . '/static/');
@unlink(RUNTIME_FILE);
$this->ajaxReturn(1, L('clear_success'));
}
示例2: clearCache
function clearCache()
{
import("ORG.Io.Dir");
$dir = new Dir();
if (is_dir(CACHE_PATH)) {
$dir->del(CACHE_PATH);
}
if (is_dir(TEMP_PATH)) {
$dir->del(TEMP_PATH);
}
if (is_dir(LOG_PATH)) {
$dir->del(LOG_PATH);
}
if (is_dir(DATA_PATH . '_fields/')) {
$dir->del(DATA_PATH . '_fields/');
}
if (is_dir("./index/Runtime/Cache/")) {
$dir->del("./index/Runtime/Cache/");
}
if (is_dir("./index/Runtime/Temp/")) {
$dir->del("./index/Runtime/Temp/");
}
if (is_dir("./index/Runtime/Logs/")) {
$dir->del("./index/Runtime/Logs/");
}
if (is_dir("./index/Runtime/Data/_fields/")) {
$dir->del("./index/Runtime/Data/_fields/");
}
$this->display('index');
}
示例3: public_cache
public function public_cache()
{
if (isset($_GET['type'])) {
import("Dir");
import('Cacheapi');
$Cache = new Cacheapi();
$Cachepath = RUNTIME_PATH;
$Dir = new Dir();
$type = $this->_get("type");
switch ($type) {
case "site":
try {
$Dir->del($Cachepath);
$Dir->del($Cachepath . "Data/");
$Dir->del($Cachepath . "Data/_fields/");
} catch (Exception $exc) {
}
try {
$cache = Cache::getInstance();
$cache->clear();
} catch (Exception $exc) {
}
$modules = array(array('name' => "菜单,模型,栏目缓存更新成功!", 'function' => 'site_cache', 'param' => ''), array('name' => "模型字段缓存更新成功!", 'function' => 'model_field_cache', 'param' => ''), array('name' => "模型content处理类缓存更新成功!", 'function' => 'model_content_cache', 'param' => ''), array('name' => "会员相关缓存更新成功!", 'function' => 'member_cache', 'param' => ''), array('name' => "应用更新成功!", 'function' => 'appstart_cache', 'param' => ''), array('name' => "敏感词缓存生成成功!", 'function' => 'censorword_cache', 'param' => ''));
foreach ($modules as $k => $v) {
try {
if ($v['function']) {
$Cache->{$v}['function']();
}
} catch (Exception $exc) {
}
}
$this->success("站点数据缓存更新成功!", U('Index/public_cache'));
break;
case "template":
$Dir->delDir($Cachepath . "Cache/");
$this->success("模板缓存清理成功!", U('Index/public_cache'));
break;
case "logs":
$Dir->del($Cachepath . "Logs/");
$this->success("站点日志清理成功!", U('Index/public_cache'));
break;
default:
$this->error("请选择清楚缓存类型!");
break;
}
} else {
$this->display("Index:cache");
}
}
示例4: setup
function setup()
{
$post = $_POST;
$file = $post['path_root'] . '/' . trim($post['filename'], '.php') . '.php';
$appgroup = empty($post['appgroup']) ? '' : "\tdefine('APP_GROUP','{$post['appgroup']}');//应用组目录 \n";
$appname = empty($post['appname']) ? '' : "\tdefine('APP_NAME','{$post['appname']}');//应用名 \n";
$compile = $post['compile'] ? "\tdefine('COMPILE',true);//是否生成核心编译文件\n" : "define('COMPILE',false);//是否生成核心编译文件 \n";
$path_hdphp = dirname(PATH_ROOT) . '/hdphp/hdphp.php';
$str = '<?php ' . "\n\t//www.hdphp.com 向军\n" . $appgroup . $appname . $compile . "\tinclude '{$path_hdphp}'; //HD框架核心包 \n" . '?>';
$appgroup = empty($post['appgroup']) ? $post['appgroup'] : $post['appgroup'] . '/';
$url = $post['root'] . '/' . basename($file);
$appDir = PATH_ROOT . '/' . $appgroup . $post['appname'];
//删除缓存
$cachefiles = glob($_POST['path_root'] . '/temp/*');
foreach ($cachefiles as $v) {
$fileName = basename($v);
if (in_array($fileName, array("log", "Session"))) {
continue;
}
Dir::del($v);
}
if (is_dir($appDir)) {
$this->error("应用{$post['appname']}已经创建,请删除后再创建");
}
if (is_file($file)) {
$this->error("单入口文件已经存在");
}
if (file_put_contents($file, $str)) {
$this->success("单入口文件创建成功", $url);
} else {
$this->error('文件创建失败,请检查目录权限');
}
}
示例5: cache
public function cache()
{
if (isset($_GET['type'])) {
$Dir = new \Dir();
$cache = D('Common/Cache');
$type = I('get.type');
switch ($type) {
case "template":
//删除缓存目录下的文件
$Dir->del(RUNTIME_PATH);
$Dir->delDir(RUNTIME_PATH . "Cache/");
$Dir->delDir(RUNTIME_PATH . "Temp/");
//更新开启其他方式的缓存
\Think\Cache::getInstance()->clear();
$this->success("模板缓存清理成功!", U('Index/cache'));
break;
case "logs":
$Dir->delDir(RUNTIME_PATH . "Logs/");
$this->success("站点日志清理成功!", U('Index/cache'));
break;
default:
$this->error("请选择清楚缓存类型!");
break;
}
} else {
$this->display();
}
}
示例6: sp_clear_cache
/**
* 清空缓存
*/
function sp_clear_cache()
{
import("ORG.Util.Dir");
$dirs = array();
// runtime/
$rootdirs = scandir(RUNTIME_PATH);
//$noneed_clear=array(".","..","Data");
$noneed_clear = array(".", "..");
$rootdirs = array_diff($rootdirs, $noneed_clear);
foreach ($rootdirs as $dir) {
if ($dir != "." && $dir != "..") {
$dir = RUNTIME_PATH . $dir;
if (is_dir($dir)) {
array_push($dirs, $dir);
$tmprootdirs = scandir($dir);
foreach ($tmprootdirs as $tdir) {
if ($tdir != "." && $tdir != "..") {
$tdir = $dir . '/' . $tdir;
if (is_dir($tdir)) {
array_push($dirs, $tdir);
}
}
}
} else {
@unlink($dir);
}
}
}
$dirtool = new Dir("");
foreach ($dirs as $dir) {
$dirtool->del($dir);
}
if (defined('IS_SAE') && IS_SAE) {
$global_mc = @memcache_init();
if ($global_mc) {
$global_mc->flush();
}
$no_need_delete = array("THINKCMF_DYNAMIC_CONFIG");
$kv = new SaeKV();
// 初始化KVClient对象
$ret = $kv->init();
// 循环获取所有key-values
$ret = $kv->pkrget('', 100);
while (true) {
foreach ($ret as $key => $value) {
if (!in_array($key, $no_need_delete)) {
$kv->delete($key);
}
}
end($ret);
$start_key = key($ret);
$i = count($ret);
if ($i < 100) {
break;
}
$ret = $kv->pkrget('', 100, $start_key);
}
}
}
示例7: updateCache
public function updateCache()
{
$ActionCache = F('updateCache');
if ($ActionCache) {
$action = array_shift($ActionCache);
F('updateCache', $ActionCache);
switch ($action) {
case "Config":
$Model = K("Config");
$Model->updateCache();
$this->success('网站配置更新完毕...', U("updateCache"), 0);
break;
case "Model":
$Model = K("Model");
$Model->updateCache();
$this->success('模型更新完毕...', U("updateCache"), 0);
break;
case "Field":
$Model = new ModelFieldModel(1);
$ModelCache = cache("model");
foreach ($ModelCache as $mid => $data) {
$Model->updateCache($mid);
}
$this->success('字段更新完毕...', U("updateCache"), 0);
break;
case "Category":
$Model = K("Category");
$Model->updateCache();
$this->success('栏目更新完毕...', U("updateCache"), 0);
break;
case "Node":
$Model = K("Node");
$Model->updateCache();
$this->success('权限节点更新完毕...', U("updateCache"), 0);
break;
case "Table":
cache('table', null);
$this->success('数据表更新完毕...', U("updateCache"), 0);
break;
case "Role":
$Model = K("Role");
$Model->updateCache();
$this->success('角色更新完毕...', U("updateCache"), 0);
break;
case "Flag":
$Model = new FlagModel(1);
$ModelCache = cache("model");
foreach ($ModelCache as $mid => $data) {
$Model->updateCache($mid);
}
$this->success('Flag更新完毕...', U("updateCache"), 0);
break;
}
} else {
Dir::del('temp');
$this->success('缓存更新成功...', U('index'), 0);
}
}
示例8: del
public function del()
{
$r = Dir::del('Backup/' . $_GET['dir']);
if ($r) {
$this->success('删除成功');
} else {
$this->error('删除失败');
}
}
示例9: del
public function del()
{
$dir = Q('dir');
if (Dir::del('backup/' . $dir)) {
$this->success('删除成功!', 'index');
} else {
$this->error('删除失败,请检查目录权限!', 'index');
}
}
示例10: updateCache
public function updateCache()
{
if ($action = Q('get.action')) {
switch ($action) {
case "Config":
$Model = K("Config");
$Model->updateCache();
$this->success('网站配置更新完毕...', U('updateCache', array('action' => 'Model')), 0);
break;
case "Model":
$Model = K("Model");
$Model->updateCache();
$this->success('模型更新完毕...', U('updateCache', array('action' => 'Field')), 0);
break;
case "Field":
$ModelCache = S("model");
foreach ($ModelCache as $mid => $data) {
$_REQUEST['mid'] = $mid;
$Model = new FieldModel();
$Model->updateCache($mid);
}
$this->success('字段更新完毕...', U('updateCache', array('action' => 'Category')), 0);
break;
case "Category":
$Model = K('Category');
$Model->updateCache();
$this->success('栏目更新完毕...', U('updateCache', array('action' => 'Node')), 0);
break;
case "Node":
$Model = K("Node");
$Model->updateCache();
$this->success('权限节点更新完毕...', U('updateCache', array('action' => 'Table')), 0);
break;
case "Table":
Dir::del('temp/Table');
$this->success('数据表更新完毕...', U('updateCache', array('action' => 'Role')), 0);
break;
case "Role":
$Model = K("Role");
$Model->updateCache();
$this->success('角色更新完毕...', U('updateCache', array('action' => 'Flag')), 0);
break;
case "Flag":
$ModelCache = S("model");
foreach ($ModelCache as $mid => $data) {
$_REQUEST['mid'] = $mid;
$Model = new FlagModel();
$Model->updateCache();
}
$this->display('success.php');
break;
}
} else {
$this->success('缓存更新成功...', U('index'), 0);
}
}
示例11: clearCache
function clearCache()
{
set_time_limit(0);
$i = intval($_REQUEST['id']);
if (!$i) {
$this->error('操作失败');
} else {
import("ORG.Io.Dir");
$dir = new Dir();
switch ($i) {
case 1:
//更新全站缓存
is_dir(CACHE_PATH) && $dir->del(CACHE_PATH);
is_dir(DATA_PATH . '_fields/') && $dir->del(DATA_PATH . '_fields/');
is_dir(TEMP_PATH) && $dir->del(TEMP_PATH);
if (is_dir("./index/Runtime")) {
deleteCacheData("./index/Runtime");
}
if (is_dir("./admin/Runtime")) {
deleteCacheData("./admin/Runtime");
}
//Api缓存
is_dir('./Apicache/') && delCache('./Apicache/');
break;
case 2:
//后台模版缓存
is_dir(CACHE_PATH) && $dir->del(CACHE_PATH);
break;
case 3:
//前台模版缓存
is_dir("./index/Runtime/Cache/") && $dir->del("./index/Runtime/Cache/");
is_dir("./index/Html/") && $dir->del("./index/Html/");
break;
case 4:
//数据库缓存
is_dir(DATA_PATH . '_fields/') && $dir->del(DATA_PATH . '_fields/');
is_dir("./index/Runtime/Data/_fields/") && $dir->del("./index/Runtime/Data/_fields/");
break;
case 5:
//Api缓存
is_dir('./Apicache/') && delCache('./Apicache/');
break;
default:
break;
}
$runtime = defined('MODE_NAME') ? '~' . strtolower(MODE_NAME) . '_runtime.php' : '~runtime.php';
$runtime_file_admin = RUNTIME_PATH . $runtime;
$runtime_file_front = ROOT_PATH . '/index/Runtime/' . $runtime;
is_file($runtime_file_admin) && @unlink($runtime_file_admin);
is_file($runtime_file_front) && @unlink($runtime_file_front);
$this->success('更新完成', U('Cache/index'));
}
}
示例12: delcache
function delcache()
{
$temp = Q('temp', null, 'trim');
if ($temp && is_dir($temp)) {
foreach (glob($temp . '/*') as $d) {
Dir::del($d);
}
}
$url = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
$this->success('缓存目录已经全部删除成功', $url);
}
示例13: deleteFailureDir
public function deleteFailureDir($dir)
{
foreach (Dir::tree($dir) as $d) {
if (!is_file($d['path'] . '/lock.php')) {
if (!\Dir::del($d['path'])) {
$this->error = $d['path'] . "删除失败";
return FALSE;
}
}
}
return TRUE;
}
示例14: create_all
public function create_all()
{
if (IS_POST) {
//删除html目录
Dir::del(C('HTML_PATH'));
F("RedirectInfo", array(array('url' => 'create_index', 'title' => '准备生成首页'), array('url' => 'create_category', 'title' => '准备生成栏目页...'), array('url' => 'create_content', 'title' => '准备生成内容页...'), array('url' => 'create_all', 'title' => '全部生成完毕...')));
//生成首页
$this->success('初始化完成...', 'create_index');
} else {
F("RedirectInfo", null);
$this->display();
}
}
示例15: index
public function index()
{
if (IS_POST) {
is_file(TEMP_PATH . '~Boot.php') && unlink(TEMP_PATH . '~Boot.php');
Dir::del('Temp/Compile');
Dir::del('Temp/Content');
Dir::del('Temp/Table');
//缓存更新动作
S('updateCacheAction', $_POST['Action']);
$this->success('准备更新...', U('updateCache', array('action' => 'Config')), 1);
} else {
$this->display();
}
}