本文整理汇总了PHP中delete_dir函数的典型用法代码示例。如果您正苦于以下问题:PHP delete_dir函数的具体用法?PHP delete_dir怎么用?PHP delete_dir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了delete_dir函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: scan_dir
function scan_dir($id)
{
$result = true;
foreach ($GLOBALS['db']->select("dir", ['owner' => $_SESSION["username"], 'parent' => $id]) as $d) {
$result = scan_dir($d["id"]);
}
$result = delete_dir($id);
return $result;
}
示例2: delete_dirs
function delete_dirs($dirs)
{
$rtn = 1;
foreach ($dirs as $dir) {
if (!delete_dir($dir)) {
$rtn = 0;
}
}
return $rtn;
}
示例3: uninstall
function uninstall()
{
global $_plugin;
global $success;
global $error;
global $errors;
plugin_is_installed($_plugin['name']) or $error = $errors['not_installed'];
delete_dir($_plugin['dir']['definitions']) or $error = $errors['delete_dir'];
set_as_uninstalled() or $error = $errors['uninstalling'];
$success = $_plugin['name'] . ' was successfully uninstalled';
}
示例4: bannerZoneDelete
public function bannerZoneDelete($id)
{
$this->load->helper('directory');
$this->db->trans_start();
$this->db->where('id', $id);
$this->db->delete('banners_zones');
$this->db->where('parent_id', $id);
$this->db->delete('banners_banners');
$this->db->trans_complete();
delete_dir(APPPATH . 'assets/images/banners/' . $id);
}
示例5: delete_dir
function delete_dir($dir)
{
if (!is_dir($dir)) {
return 1;
}
$handle = @glob($dir . "/*");
for ($i = 0; $i < count($handle); $i++) {
is_dir($handle[$i]) ? delete_dir($handle[$i]) : unlink($handle[$i]);
}
rmdir($dir);
return is_dir($dir) ? 1 : 0;
}
示例6: delete_dir
private function delete_dir($src)
{
$dir = opendir($src);
while (false !== ($file = readdir($dir))) {
if ($file != '.' && $file != '..') {
if (is_dir($src . '/' . $file)) {
delete_dir($src . '/' . $file);
} else {
unlink($src . '/' . $file);
}
}
}
rmdir($src);
closedir($dir);
}
示例7: delete_dir
/**
* Deleting a folder recursively
* @ingroup G-0003
*/
function delete_dir($path)
{
$file_scan = scandir($path);
foreach ($file_scan as $filecheck) {
$file_extension = pathinfo($filecheck, PATHINFO_EXTENSION);
if ($filecheck != '.' && $filecheck != '..') {
if ($file_extension == '') {
delete_dir($path . $filecheck . '/');
} else {
unlink($path . $filecheck);
}
}
}
rmdir($path);
}
示例8: delete_dir
function delete_dir($dirPath)
{
if (substr($dirPath, strlen($dirPath) - 1, 1) != '/') {
$dirPath .= '/';
}
$files = glob($dirPath . '*', GLOB_MARK);
foreach ($files as $file) {
if (is_dir($file)) {
delete_dir($file);
} else {
unlink($file);
}
}
rmdir($dirPath);
}
示例9: delete_dir
function delete_dir($dir)
{
if (!file_exists($dir)) {
return true;
}
if (!is_dir($dir)) {
return @unlink($dir);
}
foreach (scandir($dir) as $item) {
if ($item == '.' || $item == '..') {
continue;
}
if (!delete_dir($dir . DIRECTORY_SEPARATOR . $item)) {
return false;
}
}
return rmdir($dir);
}
示例10: delete_dir
function delete_dir($dirPath)
{
if (!is_dir($dirPath)) {
throw new InvalidArgumentException("{$dirPath} must be a directory");
}
if (substr($dirPath, strlen($dirPath) - 1, 1) != '/') {
$dirPath .= '/';
}
$files = glob($dirPath . '*', GLOB_MARK);
foreach ($files as $file) {
if (is_dir($file)) {
delete_dir($file);
} else {
unlink($file);
}
}
rmdir($dirPath);
}
示例11: delete_dir
function delete_dir($dir)
{
if (($dh = opendir($dir)) != false) {
while (($file = readdir($dh)) !== false) {
if ($file === '.' || $file === '..') {
continue;
}
$file = $dir . $file;
if (is_dir($file)) {
delete_dir($file . '/');
} else {
unlink($file);
}
}
closedir($dh);
}
rmdir($dir);
}
示例12: clear_cache
/**
* 调用清除缓存数据
*/
function clear_cache()
{
//调用common里面的delete_dir()函数删除目录
$dir = RUNTIME_PATH;
//由于Runtime_path默认为 "./admin/Runtime/",我们必须删除最后的 “/”
$dir = substr($dir, 0, strlen($dir) - 1);
if (delete_dir($dir)) {
//清空前台缓存
$front_dir = './Home/Runtime';
delete_dir($front_dir);
//清空静态缓存目录
delete_dir(HTML_PATH);
//调用显示模板
$this->assign("jumpUrl", "__APP__/Manage/index");
$this->success("缓存清除成功,页面跳转中~~~");
} else {
$this->assign("jumpUrl", "__APP__/Manage/index");
$this->error("缓存清除失败,返回控制面板!");
}
}
示例13: deleteDir
private function deleteDir($location){
if(is_dir($location)) {
$all = @opendir($location);
while (false !== ($file = @readdir($all))) {
if (is_dir("$location/$file") && $file != '..' && $file != '.') {
delete_dir("$location/$file");
} elseif (is_file("$location/$file")) {
@unlink("$location/$file");
}
unset($file);
}
closedir($all);
@rmdir($location);
} else {
if (file_exists($location)) {
@unlink($location);
}
}
return true;
}
示例14: importAction
public function importAction()
{
$dir = DATA_DIR . 'bakup' . DIRECTORY_SEPARATOR;
$path = $this->get('path');
if ($path && is_dir($dir . $path)) {
$fileid = $this->get('fileid');
$this->importdb($path, $fileid);
exit;
}
if ($this->post('submit')) {
$paths = $this->post('paths');
if (is_array($paths)) {
foreach ($paths as $path) {
delete_dir($dir . $path . '/');
@rmdir($dir . $path);
}
}
$this->show_message('操作成功', 1, url('database/import'));
}
if (!is_dir($dir)) {
mkdirs($dir);
}
$file_list = glob($dir . '*');
$list = array();
foreach ($file_list as $v) {
if (is_dir($v)) {
$size = 0;
$_dir = glob($v . DIRECTORY_SEPARATOR . '*.sql');
foreach ($_dir as $c) {
$size += filesize($c);
}
$path = basename($v);
$sqldir = '/data/bakup/' . $path . '/';
$list[] = array('path' => $path, 'size' => file_size_count($size), 'sqldir' => $sqldir);
}
}
include $this->admin_tpl('database_import');
}
示例15: delete_thumbnaildir
private function delete_thumbnaildir()
{
$thumbnailsdir = SlideshowJedoGallery::thumbnails_slideshowjedogallery_path();
if (file_exists($thumbnailsdir)) {
@chmod($thumbnailsdir, 0777);
//삭제하려는 폴더의 퍼미션을 777로 재 지정
$directory = dir($thumbnailsdir);
while ($entry = $directory->read()) {
if ($entry != "." && $entry != "..") {
if (is_dir($thumbnailsdir . "/" . $entry)) {
//삭제하려는 폴더안에 서브 폴더가 있을경우 재루프
delete_dir($thumbnailsdir . "/" . $entry);
} else {
@chmod($thumbnailsdir . "/" . $entry, 0777);
//삭제하려는 폴더안에 파일일 경우 파일 퍼미션을 777로 재지정
@UnLink($thumbnailsdir . "/" . $entry);
}
}
}
$directory->close();
@rmdir($thumbnailsdir);
}
return false;
}