本文整理汇总了PHP中dir_delete函数的典型用法代码示例。如果您正苦于以下问题:PHP dir_delete函数的具体用法?PHP dir_delete怎么用?PHP dir_delete使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dir_delete函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
/**
* 批量保存配置
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
*/
public function save($config)
{
$old['artid'] = M('Config')->where(array('name' => 'WXARTID'))->getField('value');
if ($config && is_array($config)) {
$Config = M('Config');
foreach ($config as $name => $value) {
$map = array('name' => $name);
if ($name == 'WXARTID') {
if ($old['artid'] != $value) {
asyn_sendwx();
//$WX->sendwx();
}
}
if ($name == 'WXPASS') {
$value = think_encrypt($value, UC_AUTH_KEY);
}
$Config->where($map)->setField('value', $value);
}
}
S('DB_CONFIG_DATA', null);
$config_file = './App/Home/Conf/theme.php';
$themename = (include $config_file);
if ($config['WEB_THEME'] != $themename['DEFAULT_THEME']) {
//写入配置文件
$theme['DEFAULT_THEME'] = $config['WEB_THEME'];
file_put_contents($config_file, "<?php \nreturn " . var_export($theme, true) . ";", LOCK_EX);
dir_delete(RUNTIME_PATH);
}
$this->mtReturn(200, '网站配置保存成功!', '', 'forward', U('group'));
}
示例2: all_delete
function all_delete($dir_file)
{
if (is_dir($dir_file)) {
$array = dir_delete($dir_file);
$array = array_reverse($array);
foreach ($array as $elem) {
@rmdir($elem);
}
} elseif (is_file($dir_file)) {
@unlink($dir_file);
}
}
示例3: rollback
public function rollback()
{
$this->setProgress(0, 'Rolling back...');
$this->dbRemoveAll();
if (is_dir($this->packageFolder)) {
dir_delete($this->packageFolder);
}
if (is_file($this->packageFile)) {
@unlink($this->packageFile);
}
$this->setProgress(0, 'Roll back finished: Ok. ');
}
示例4: cache
public function cache()
{
dir_delete(CACHE_PATH . 'Html/');
dir_delete(CACHE_PATH . 'Tpl/');
dir_delete(CACHE_PATH . 'Temp/');
if (is_file(RUNTIME_FILE)) {
@unlink(RUNTIME_FILE);
}
R('Admin/Category/repair');
R('Admin/Category/repair');
foreach ($this->cache_model as $r) {
savecache($r);
}
$forward = $_GET['forward'] ? $_GET['forward'] : U('Index/main');
$this->assign('jumpUrl', $forward);
$this->success(L('do_success'));
}
示例5: images
public function images()
{
$path = $this->publicpath . 'images/' . $_GET['folder'];
$this->assign('Public', $this->publicpath);
$uppath = explode('/', $_GET['folder']);
$leve = count($uppath) - 1;
unset($uppath[$leve]);
if ($leve > 1) {
unset($uppath[$leve - 1]);
$uppath = implode('/', $uppath) . '/';
} else {
$uppath = '';
}
$this->assign('leve', $leve);
$this->assign('uppath', $uppath);
if ($_GET['delete']) {
$file = $path . $_GET['filename'];
if (file_exists($file)) {
is_dir($file) ? dir_delete($file) : unlink($file);
$this->success(L('delete_ok'));
} else {
$this->error(L('file_no_find'));
}
}
$files = glob($path . '*');
$folders = array();
foreach ($files as $key => $file) {
$filename = basename($file);
if (is_dir($file)) {
$folders[$key]['filename'] = $filename;
$folders[$key]['filepath'] = $file;
$folders[$key]['ext'] = 'folder';
} else {
$templates[$key]['filename'] = $filename;
$templates[$key]['filepath'] = $file;
$templates[$key]['ext'] = strtolower(substr($filename, strrpos($filename, '.') - strlen($filename) + 1));
if (!in_array($templates[$key]['ext'], array('gif', 'jpg', 'png', 'bmp'))) {
$templates[$key]['ico'] = 1;
}
}
}
$this->assign('path', $path);
$this->assign('folders', $folders);
$this->assign('files', $templates);
$this->display();
}
示例6: cache
public function cache()
{
dir_delete(RUNTIME_PATH . 'Html/');
dir_delete(RUNTIME_PATH . 'Cache/');
if (is_file(RUNTIME_PATH . '~runtime.php')) {
@unlink(RUNTIME_PATH . '~runtime.php');
}
if (is_file(RUNTIME_PATH . '~allinone.php')) {
@unlink(RUNTIME_PATH . '~allinone.php');
}
R('Admin/Category/repair');
R('Admin/Category/repair');
foreach ($this->cache_model as $r) {
savecache($r);
}
$this->assign('jumpUrl', U('Main/main'));
$this->success(L('do_success'));
}
示例7: dir_delete
function dir_delete($dir)
{
$dir = dir_path($dir);
if (!is_dir($dir)) {
return false;
}
$list = glob($dir . '*');
foreach ($list as $file) {
is_dir($file) ? dir_delete($file) : unlink($file);
}
return rmdir($dir);
}
示例8: dir_delete
function dir_delete($df)
{
echo "<b>" . basename($df) . "</b><ul>";
if ($dir = opendir($df)) {
$i = 0;
while (($file = readdir($dir)) !== false) {
if ($file == "." || $file == "..") {
continue;
}
if (is_dir("{$df}/{$file}")) {
dir_delete($df . "/" . $file);
} else {
echo "{$file}<br>";
echo "" . mm("DELETE") . " <tt>{$df}/{$file}</tt> ...<br>";
unlink($df . "/" . $file);
}
$i++;
}
//if ($i==0) echo "-empty-<br>";
}
closedir($dir);
echo "</ul>";
echo "" . mm("DELETE") . " " . mm("DIR") . " <tt>{$df}</tt> ...<br>";
rmdir("{$df}/{$file}");
}
示例9: index
public function index()
{
$v = explode(' ', VERSION);
$menuid = intval($_REQUEST['menuid']);
$var = $v[0];
$upgrade_path = $this->_url . $var . '/patch/';
$upgrade_path_str = @file_get_contents($upgrade_path);
$allpatch = json_decode($upgrade_path_str);
$patchlist = $patchlists = array();
$key = -1;
foreach ($allpatch as $k => $v) {
if (strstr($v, 'patch_' . UPDATETIME)) {
$key = $k;
break;
}
}
$key = $key < 0 ? '999' : $key;
foreach ($allpatch as $k => $v) {
if ($k >= $key) {
$patchlist[$k]['file'] = $v;
$time = explode('_', $v);
$patchlist[$k]['oldtime'] = $time[1];
$time = explode('.', $time[2]);
$patchlist[$k]['filemtime'] = $time[0];
}
}
if (!empty($_GET['do'])) {
$cover = intval($_REQUEST['cover']);
import("@.ORG.Http");
import("@.ORG.Phpzip");
foreach ($patchlist as $k => $v) {
//远程压缩包地址
$upgradezip_url = $upgrade_path . $v['file'];
//保存到临时文件夹
$upgradezip_file = TEMP_PATH . $v['file'];
//解压路径
$upgradezip_source_path = TEMP_PATH . basename($v['file'], ".zip");
//备份路径
$backupdir = TEMP_PATH . 'bakup_' . $v['oldtime'];
dir_create($backupdir);
//开始下载并解压
Http::curldownload($upgradezip_url, $upgradezip_file);
Phpzip::unZip($upgradezip_file, $upgradezip_source_path);
//先做备份
$backupfilelist = dir_list($upgradezip_source_path);
foreach ((array) $backupfilelist as $k => $file) {
$fromfile = str_replace($upgradezip_source_path, './', $file);
$tofile = $backupdir . str_replace($upgradezip_source_path, '', $file);
if (is_dir($fromfile)) {
mkdir($tofile);
} elseif (is_file($fromfile)) {
copy($fromfile, $tofile);
}
}
$this->copyfileerror = 0;
//复制并加判断是否成功
$this->copydir($upgradezip_source_path, './', $cover);
//如果失败,恢复当前版本
if ($this->copyfileerror) {
$this->copydir($backupdir, './', $cover);
die(L('upgrade_error'));
} else {
if (file_exists($upgradezip_source_path . '/yourphp.sql')) {
$sqldata = file_get_contents($upgradezip_source_path . '/yourphp.sql');
$sqlFormat = sql_split($sqldata, C('DB_PREFIX'));
foreach ((array) $sqlFormat as $sql) {
$sql = trim($sql);
if (strstr($sql, 'CREATE TABLE')) {
preg_match('/CREATE TABLE `([^ ]*)`/', $sql, $matches);
$ret = $this->excuteQuery($sql);
//if($ret){echo L('CREATE_TABLE_OK').$matches[0].' <br />';}else{echo 'Error sql:'.$sql;}exit;
} else {
$ret = $this->excuteQuery($sql);
}
}
}
if (file_exists($upgradezip_source_path . '/upgrade.php')) {
include $upgradezip_source_path . '/upgrade.php';
}
dir_delete($upgradezip_source_path);
@unlink('./upgrade.php');
@unlink('./yourphp.sql');
@unlink($upgradezip_file);
}
}
$this->assign('jumpUrl', U(MODULE_NAME . '/checkfile?menuid=' . $menuid));
$this->success(L('upgrade_ok'));
exit;
}
$this->assign('menuid', $menuid);
$this->assign('var', $var);
$this->assign('patchlist', $patchlist);
$this->display();
}
示例10: exit
}
}
exit('');
break;
case 'run':
$code = stripslashes($code);
$base = DT_PATH . 'file/temp/' . dirname($temp) . '/';
$code = str_replace('src="', 'src="' . $base, $code);
echo '<html>';
echo '<meta http-equiv="Content-Type" content="text/html;charset=' . DT_CHARSET . '"/>';
echo '<body>';
echo $code;
echo '</body>';
echo '</html>';
break;
default:
if ($submit) {
if (!isset($water)) {
$DT['water_type'] = 0;
}
$content = stripslashes($content);
$dir = dirname($word);
$base = DT_PATH . 'file/temp/' . $dir . '/';
$content = str_replace('src="', 'src="' . $base, $content);
$content = save_remote($content, 'jpg|gif|png', 1);
$tmp = explode('/', $dir);
dir_delete(DT_ROOT . '/file/temp/' . $tmp[0]);
}
include tpl('word');
break;
}
示例11: cache_clear
function cache_clear($str, $type = '', $dir = '')
{
$dir = $dir ? DT_CACHE . '/' . $dir . '/' : DT_CACHE . '/';
$files = glob($dir . '*');
if (is_array($files)) {
if ($type == 'dir') {
foreach ($files as $file) {
if (is_dir($file)) {
dir_delete($file);
} else {
if (file_ext($file) == $str) {
file_del($file);
}
}
}
} else {
foreach ($files as $file) {
if (!is_dir($file) && strpos(basename($file), $str) !== false) {
file_del($file);
}
}
}
}
}
示例12: 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');
}
}
示例13: basename
$n = basename($f);
if (file_ext($n) == 'js') {
if (in_array(substr($n, 0, 1), array('A', '0'))) {
continue;
}
}
$t = filemtime($f);
if ($t >= $ft && $t <= $tt) {
$lists[] = $f;
}
}
$find = count($lists);
if ($find) {
$dir = DT_ROOT . '/file/patch/' . timetodate($ft, 'Y-m-d H.i') . '~' . timetodate($tt, 'Y-m-d H.i') . '/';
if (is_dir($dir)) {
dir_delete($dir);
}
foreach ($lists as $f) {
file_copy($f, $dir . str_replace(DT_ROOT . '/', '', $f));
@touch($dir . str_replace(DT_ROOT . '/', '', $f), filemtime($f));
}
msg('备份成功 ' . $find . ' 个文件,已保存于file/patch目录', '?file=' . $file, 5);
}
msg('没有符合条件的文件');
} else {
$files = glob(DT_ROOT . '/*');
$dirs = $rfiles = $baks = $ups = array();
foreach ($files as $f) {
$bn = basename($f);
if (is_file($f)) {
$rfiles[] = $bn;
示例14: clearTempDir
/**
* 清除临时目录
*/
public function clearTempDir()
{
dir_delete($this->TEMP);
}
示例15: dir_delete
function dir_delete($dir, $log_path = null)
{
if (!is_dir($dir)) {
return FALSE;
}
if (!empty($log_path)) {
error_log($dir . "\n", 3, $log_path . 'dir_delete.log');
}
$files = array_diff(scandir($dir), array('.', '..'));
foreach ($files as $file) {
is_dir("{$dir}/{$file}") ? dir_delete("{$dir}/{$file}", $log_path) : unlink("{$dir}/{$file}");
}
return rmdir($dir);
}