本文整理汇总了PHP中deldir函数的典型用法代码示例。如果您正苦于以下问题:PHP deldir函数的具体用法?PHP deldir怎么用?PHP deldir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了deldir函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deldir
function deldir($path){
static $count = 0;
//不是目录,真接返回
if(!is_dir($path)){
return 0;
}
$dh = opendir($path);
while(($row = readdir($dh)) != flase){
if($row == '.' || $row == '..'){
continue;
}
//判断是不是判断文件
if(!is_dir($path.'/'.$row)){
unlink($path.'/'.$row);
}else{
deldir($path.'/'.$row); //递归删除
}
if($count > 200){
break;
}
$count++;
}
closedir($dh);
rmdir($path);
echo '删除了'.$path,'<br />';
return true;
}
示例2: delete
function delete($dirname, $dirtype, $placeholder)
{
$placeholder = str_replace("\r\n", "", $placeholder);
//keng
if ($od = opendir($dirname)) {
while ($file = readdir($od)) {
echo $file . ' ';
if ($file == '..' || $file == '.') {
continue;
}
if ($placeholder !== 0 && strcmp($file, $placeholder) == 0) {
echo 'continue';
continue;
}
if (is_dir('./' . $dirname . '/' . $file)) {
if ($dirtype === 0) {
continue;
} else {
deldir('./' . $dirname . '/' . $file);
continue;
}
}
echo 'unlink ' . './' . $dirname . '/' . $file;
unlink('./' . $dirname . '/' . $file);
}
closedir($od);
}
}
示例3: deldir
function deldir($dir)
{
//先删除目录下的文件:
$dh = opendir($dir);
//如果传入的参数是目录,则使用opendir将该目录打开,将返回的句柄赋值给$dh
while ($file = readdir($dh)) {
//这里明确地测试返回值是否全等于(值和类型都相同)FALSE,否则任何目录项的名称求值为 FALSE 的都会导致循环停止(例如一个目录名为“0”)。
if ($file != "." && $file != "..") {
//在文件结构中,都会包含形如“.”和“..”的向上结构,但是它们不是文件或者文件夹
$fullpath = $dir . "/" . $file;
//当前文件$dir为文件目录+文件
if (!is_dir($fullpath)) {
//如果传入的参数不是目录,则为文件,应将其删除
unlink($fullpath);
//删除文件
} else {
deldir($fullpath);
//递归删除文件
}
}
}
closedir($dh);
//删除当前文件夹:
if (rmdir($dir)) {
return true;
} else {
return false;
}
}
示例4: ajaxUpdateCache
public function ajaxUpdateCache()
{
if (IS_AJAX) {
$cachedir = RUNTIME_PATH . 'Cache';
//Cache文件路径
if (is_dir($cachedir)) {
//打开Cache文件夹
deldir($cachedir);
}
$tempdir = RUNTIME_PATH . '/Temp/';
//Temp文件的路径
if ($handle = opendir($tempdir)) {
//打开Temp文件夹
while (($item = readdir($handle)) !== false) {
//遍历Temp目录
unlink($tempdir . $item);
//删除遍历到的每一个文件
}
closedir($handle);
}
$this->ajaxReturn(array('status' => true, 'msg' => '更新完成'), 'JSON');
} else {
$this->ajaxReturn(array('status' => true, 'msg' => '更新失败'), 'JSON');
}
}
示例5: deleteFile
static function deleteFile($fullpath)
{
if (!is_dir($fullpath)) {
unlink($fullpath);
} else {
deldir($fullpath);
}
}
示例6: deleteFiels
protected function deleteFiels($files)
{
foreach ($files as $item) {
if (strlen($item['filename']) > 5) {
deldir(WEB_ROOT . $item['filename']);
}
}
}
示例7: removeFile
function removeFile($fullpath)
{
if (is_file($fullpath)) {
return unlink($fullpath);
} elseif (is_dir($fullpath)) {
return deldir($fullpath);
}
}
示例8: del
public static function del($file, $type = 'php')
{
load::sys_func('file');
if ($type == 'file') {
@deldir(PATH_CACHE . $file);
} else {
@unlink(PATH_CACHE . $file . '.' . $type);
}
}
示例9: delete_old_process
function delete_old_process($link)
{
$ret = sqlquery('SELECT * FROM `process` where 1', $link);
while ($i = $ret->fetch(PDO::FETCH_ASSOC)) {
if (!pstatus($i['pid'])) {
sqlexec('DELETE FROM `process` where pid=?', array($i['pid']), $link);
deldir('qqbot/' . $i['id']);
}
}
}
示例10: remove
function remove($theme)
{
$theme_dir = ROOTDIR . 'themes/' . $theme;
if (is_dir($theme_dir) && deldir($theme_dir)) {
$setting_mdl =& loader::model('setting');
$setting_mdl->remove_conf('theme_' . $theme, false);
return true;
} else {
return false;
}
}
示例11: dl_error
function dl_error($alert, $type, $olid, $ver, $addr, $action, $num = 0)
{
global $checksum, $met_host, $met_file, $db, $url_array, $lang_retested, $lang_redownload, $lang_updaterr21, $lang_updaterr22;
if ($action != 'error') {
if ($action == 'dl') {
$num = $num - 1;
$conok = "olflie('{$olid}','{$ver}','dl','{$num}');";
} else {
$conok = "olupdate('{$olid}','{$ver}','{$action}');";
}
if ($action == 'dirpower') {
echo "{$lang_updaterr21} <a href=\"javascript:void(0)\" onclick=\"olupdate('{$olid}','{$ver}','{$action}');\">{$lang_retested}</a><script type=\"text/javascript\">\n\t\t\txian('{$alert}');</script>";
die;
} else {
echo "{$lang_updaterr21}<script type=\"text/javascript\">\n\t\t\talert('{$alert}');";
}
if ($action == 'check') {
echo "olupdate('{$olid}','{$ver}','error');";
} else {
echo "var con;\t\t\n\t\t\tcon=confirm('{$lang_updaterr22}');\n\t\t\tif(con){\n\t\t\t\t{$conok}\n\t\t\t}else{\n\t\t\t\tolupdate('{$olid}','{$ver}','error');\n\t\t\t}\n\t\t\t";
}
echo "</script>";
die;
}
if ($type == 1) {
echo "<a href=\"http://{$met_host}/dl/olupdate.php\" onclick=\"return olupdate('cms','new','test');\">{$lang_retested}</a>";
}
if ($type == 2) {
if ($addr) {
deldir("../app/{$addr}/");
}
$query = "select * from {$met_app} where no={$olid} and download=1";
$appver = $db->get_one($query);
$verold = is_array($appver) ? $appver['ver'] : 0;
echo "<a href='http://{$met_host}/dl/app.php' onclick=\"return olupdate('{$olid}','{$verold}','testc');\">{$lang_redownload}</a>";
}
$adminfile = $url_array[count($url_array) - 2];
$str = file_get_contents(ROOTPATH_ADMIN . "/update/{$addr}/filelist.txt");
$strs = explode('|', $str);
foreach ($strs as $addrskey => $strsval) {
$strsvalto = readmin($strsval, $adminfile, 2);
$str = file_get_contents("../../{$strsvalto}");
if ($str == 'metinfo' || $str == 'No Date') {
unlink("../../{$strsvalto}");
}
}
checksumdel($type);
unlink("../../update.php");
unlink("../../sql.sql");
if ($addr) {
deldir("../update/{$addr}/");
}
die;
}
示例12: deldir
function deldir($dir)
{
$current_dir = opendir($dir);
while ($entryname = readdir($current_dir)) {
if (is_dir("{$dir}/{$entryname}") and ($entryname != "." and $entryname != "..")) {
deldir("{$dir}/{$entryname}");
} elseif ($entryname != "." and $entryname != "..") {
unlink("{$dir}/{$entryname}");
}
}
closedir($current_dir);
}
示例13: deldir
function deldir($d)
{
$map = directory_map($d, TRUE);
foreach ($map as $item) {
if (is_file($d . $item)) {
unlink($d . $item);
} else {
deldir($d . $item . '/');
}
}
rmdir($d . '/');
}
示例14: delcache
function delcache($dir)
{
$handle = opendir($dir);
while (false!==($FolderOrFile = readdir($handle)))
{
if($FolderOrFile != "." && $FolderOrFile != "..")
{
if(is_dir("$dir/$FolderOrFile"))
{ deldir("$dir/$FolderOrFile"); } // recursive
else
{ unlink("$dir/$FolderOrFile"); }
}
}
}
示例15: deldir
function deldir($dir)
{
$dh = opendir($dir);
while ($file = readdir($dh)) {
if ($file != "." && $file != "..") {
$fullpath = $dir . "/" . $file;
if (!is_dir($fullpath)) {
unlink($fullpath);
} else {
deldir($fullpath);
}
}
}
}