本文整理汇总了PHP中recursiveRemoveDirectory函数的典型用法代码示例。如果您正苦于以下问题:PHP recursiveRemoveDirectory函数的具体用法?PHP recursiveRemoveDirectory怎么用?PHP recursiveRemoveDirectory使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了recursiveRemoveDirectory函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: recursiveRemoveDirectory
function recursiveRemoveDirectory($directory)
{
foreach (glob("{$directory}/*") as $file) {
if (is_dir($file)) {
recursiveRemoveDirectory($file);
} else {
unlink($file);
}
}
rmdir($directory);
}
示例2: recursiveRemoveDirectory
function recursiveRemoveDirectory($directory)
{
if (strpos($directory, 'styles') !== false) {
// safety precaution
// alright to proceed
} else {
die;
}
foreach (glob($directory . '/*') as $file) {
if (is_dir($file)) {
recursiveRemoveDirectory($file);
} else {
unlink($file);
}
}
rmdir($directory);
}
示例3: recursiveRemoveDirectory
function recursiveRemoveDirectory($path)
{
$dir = new RecursiveDirectoryIterator($path);
//Remove all files
foreach (new RecursiveIteratorIterator($dir) as $file) {
unlink($file);
}
//Remove all subdirectories
foreach ($dir as $subDir) {
//If a subdirectory can't be removed, it's because it has subdirectories, so recursiveRemoveDirectory is called again passing the subdirectory as path
if (!@rmdir($subDir)) {
recursiveRemoveDirectory($subDir);
}
}
//Remove main directory
rmdir($path);
}
示例4: recursiveRemoveDirectory
function recursiveRemoveDirectory($dir)
{
$dir = str_replace('\\', '/', $dir);
$dir = str_replace('/..', '', $dir);
if (is_dir($dir)) {
$ResDir = opendir($dir);
while ($file = readdir($ResDir)) {
if ($file != '.' and $file != '..') {
if (is_dir("{$dir}/{$file}")) {
recursiveRemoveDirectory("{$dir}/{$file}");
} elseif (file_exists("{$dir}/{$file}")) {
unlink("{$dir}/{$file}");
}
}
}
closedir($ResDir);
}
rmdir($dir);
}
示例5: recursiveRemoveDirectory
/**
* Recursively remove directory
*
* @param $dir
* @return void
*/
function recursiveRemoveDirectory($dir)
{
$files = glob($dir . '*', GLOB_MARK);
foreach ($files as $file) {
if (DIRECTORY_SEPARATOR === substr($file, -1)) {
recursiveRemoveDirectory($file);
} else {
unlink($file);
}
}
if (is_dir($dir)) {
rmdir($dir);
}
}
示例6: recursiveMoveDirectory
function recursiveMoveDirectory($src, $dest)
{
if (copyr($src, $dest)) {
recursiveRemoveDirectory($src);
return TRUE;
}
return FALSE;
}
示例7: recursiveRemoveDirectory
$profile_img = "<img src='{$check_pic}' width='100px' height= '100px' />";
} else {
$profile_img = "<img src='{$default_pic}' width='100px' height= '100px' />";
}
}
global $gbizObj;
if (isset($_POST['btnDel'])) {
$msg = "";
global $gbizObj;
$gbizObj->setListingId($lid);
for ($i = 1; $i <= 8; $i++) {
$gbizObj->delete($i);
}
//delete listing directory and all its contents
$dirPath = "biz/{$lid}";
recursiveRemoveDirectory($dirPath);
header("Location: view_listings.php?id={$id}");
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title><?php
print DOMAIN_NAME . " :: " . "{$logOptions_username}";
?>
's listings</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Le styles -->
<link href="public/css/bootstrap.css" rel="stylesheet">
<link href="public/css/bootstrap.min.css" rel="stylesheet">
示例8: pierry_product360_delete_post
function pierry_product360_delete_post($post_ID)
{
$post = get_post($post_ID);
if (pathinfo($post->guid, PATHINFO_EXTENSION) == 'tvu') {
$zip_file = get_attached_file($post_ID);
$to_dir = preg_replace('/\\.[^.\\s]{3,4}$/', '', $zip_file);
recursiveRemoveDirectory($to_dir);
}
}
示例9: recursiveRemoveDirectory
function recursiveRemoveDirectory($path)
{
$dir = scandir($path);
foreach ($dir as $item) {
if ($item != '..' && $item != '.') {
if (is_file("{$path}/{$item}")) {
unlink("{$path}/{$item}");
}
if (is_dir("{$path}/{$item}")) {
recursiveRemoveDirectory("{$path}/{$item}");
}
}
}
rmdir($path);
}
示例10: removerecordfile
public function removerecordfile($id, $recordname, $filename)
{
$query_q = 'UPDATE cms_content SET ' . $recordname . ' = "" WHERE id = "' . $id . '"';
$query_r = mysql_query($query_q);
$eqApp = new Apps();
foreach (glob('resources/uploads/' . $id . '/' . $recordname . '/*') as $file) {
if (is_dir($file)) {
recursiveRemoveDirectory($file);
} else {
unlink($file);
}
}
$eqApp->rrmdir('resources/uploads/' . $id . '/' . $recordname);
exit;
}
示例11: filldata
function filldata($syllabustmp)
{
recursiveRemoveDirectory("tmpfilesloc");
if ($syllabustmp == "All") {
$str = "";
$syllabusdata = ExecuteNonQuery("select * from section where semid=" . $_SESSION['ddlsbssem'] . " and active=1");
$sylarr = array();
$sbscnt = 0;
while ($syllabusinfo = mysqli_fetch_assoc($syllabusdata)) {
$cno = GetSingleField("select courseno from courses where cid=(select cid from course_section where csid=" . $syllabusinfo["csid"] . ")", "courseno");
$cnot = substr($cno, 0, 1);
if ($cnot == "C") {
$version = GetSingleField("select version from fileinfo where active=1 and ftype='matrix'", "version");
} else {
$version = GetSingleField("select version from fileinfo where active=1 and ftype='gmatrix'", "version");
}
$cnm = GetSingleField("select coursename from courses where courseno like '" . $cno . "'", "coursename");
$desc = GetSingleField("select description from courses where courseno like '" . $cno . "'", "description");
$credits = GetSingleField("select credits from courses where courseno like '" . $cno . "'", "credits");
$sem = GetSingleField("select semname from semester where active=1", "semname");
$pid = GetSingleField("select prereqid from courses where courseno like '" . $cno . "'", "prereqid");
$cid = GetSingleField("select coreqid from courses where courseno like '" . $cno . "'", "coreqid");
$prereq = GetSingleField("select pcname from pre_req where prereqid={$pid}", "pcname");
$coreq = GetSingleField("select ccname from co_req where coreqid={$cid}", "ccname");
$sql = "select starttime,endtime,cday,roomno from facultyhours where uid=" . $syllabusinfo["uid"] . " and semid=" . $_SESSION["ddlsbssem"] . " and csid=" . $syllabusinfo["csid"];
$web = GetSingleField('select website from section where sectionid=' . $syllabusinfo["sectionid"], 'website');
$reqmaterials = GetSingleField('select reqmaterials from section where sectionid=' . $syllabusinfo["sectionid"], 'reqmaterials');
$uid = $syllabusinfo["uid"];
$dt2 = ExecuteNonQuery($sql);
while ($inf2 = mysqli_fetch_assoc($dt2)) {
$classloc = $inf2["roomno"];
$cday = explode(" ", $inf2["cday"]);
$tmp = explode(":", $inf2["starttime"]);
$sttimehr = $tmp[0];
$sttimemin = substr($tmp[1], 0, 2);
$sttimeampm = substr($tmp[1], -2);
$tmp1 = explode(":", $inf2["endtime"]);
$entimehr = $tmp1[0];
$entimemin = substr($tmp1[1], 0, 2);
$entimeampm = substr($tmp1[1], -2);
}
$str = "<table width='100%'><tr>\r\n\t\t\t\t\t\t <td><h3><b>Gannon University</b></h3></td>\r\n\t\t\t\t\t\t<td style='text-align:right'><h3><b>Department of Computer and Information Science</b></h3></td>\r\n\t\t\t\t\t </tr> \r\n\t\t\t\t\t </table>\r\n\t\t\t\t\t<table style='width:100%' border='1'>\r\n\t\t\t\t<tr>\r\n\t\t\t\t<td>\r\n\t\t\t\t\r\n\t\t\t\t\t <table>";
$data = ExecuteNonQuery('select * from users where uid=' . $uid);
$inst = '';
$offrno = '';
$ph = '';
$email = '';
while ($info = mysqli_fetch_assoc($data)) {
$inst = $info['salutation'] . ' ' . $info['firstname'] . $info['lastname'];
$offrno = $info['office'];
$ph = $info['officeno'];
$email = $info['email'];
}
$str .= "<tr><td><b>Instructor:</b></td>\r\n\t\t\t\t\t\t<td>" . $inst . "</td>" . "</tr><tr>\r\n\t\t\t\t\t\t<td><b>Office:</b></td>\r\n\t\t\t\t\t\t<td>" . $offrno . "</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td><b>Phone:</b></td>\r\n\t\t\t\t\t\t<td>" . $ph . "</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td><b>Email:</b></td>\r\n\t\t\t\t\t\t<td>" . $email . "</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t </table>\r\n\t\t\t\t\t </td>\r\n\t\t\t\t\t <td>\r\n\t\t\t\t\t <table>\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td colspan='2'><b>Office Hours</b></td>\r\n\t\t\t\t\t\t</tr>";
$data1 = ExecuteNonQuery('select starttime,endtime,cday from facultyhours where uid=' . $uid . ' and semid=' . $_SESSION['ddlsbssem'] . ' and type=\'office\'');
while ($info1 = mysqli_fetch_assoc($data1)) {
$str .= "<tr>\r\n\t\t\t\t\t\t\t\t\t<td>" . $info1['cday'] . ':' . "</td>" . "<td>" . $info1['starttime'] . ':' . $info1['endtime'] . "</td>\r\n\t\t\t\t\t\t\t\t</tr>";
}
$str .= "</table></td>\r\n \t\t\t\t\t </tr>\r\n \t\t\t\t\t </table>\r\n \t<table border='1'>\r\n\t <tr>\r\n \t<td>Course Title:</td>\r\n <td>";
if (isset($cnm) && $cnm != '') {
$str .= $cnm;
}
$str .= "</td>" . "</tr>\r\n \t<tr>\r\n \t<td>Credit Hours:</td>\r\n <td>";
if (isset($credits) && $credits != '') {
$str .= $credits;
}
$str .= ' credit(s)' . "</td>" . "\r\n </tr>";
$str .= "<tr>\r\n \t<td>Semester:</td>\r\n <td>";
if (isset($sem) && $sem != '') {
$str .= $sem;
}
$str .= "</td>\r\n </tr>\r\n \t<tr>\r\n \t<td>Class Location:</td>\r\n <td>";
if (isset($classloc) && $classloc != '') {
$str .= $classloc;
}
$str .= "</td></tr>";
$sday = "";
if (in_array('M', $cday)) {
$sday .= 'M ';
}
if (in_array('T', $cday)) {
$sday .= 'T ';
}
if (in_array('W', $cday)) {
$sday .= 'W ';
}
if (in_array('Th', $cday)) {
$sday .= 'Th ';
}
if (in_array('F', $cday)) {
$sday .= 'F ';
}
$str .= "\r\n <tr>\r\n \t<td>Class Time:</td>\r\n <td>";
$str .= $sday . " " . $sttimehr . ':' . $sttimemin . ' ' . $sttimeampm . "\r\n <b> to</b>" . $entimehr . ':' . $entimemin . ' ' . $entimeampm . "</option>\r\n \r\n </td>\r\n </tr> <tr>\r\n \t\t<td>Course Description:</td>\r\n \r\n \t\t<td>";
if (isset($desc) && $desc != '') {
$str .= $desc;
}
$str .= "</td></tr>";
$str .= "<tr>\r\n \t\t<td>Course Learning Objectives:</td>\r\n \r\n <td>\r\n The student will be able to<br>";
$cnot = substr($cno, 0, 1);
//.........这里部分代码省略.........
示例12: save
public function save()
{
$eqApp = new Apps();
$getFinfo_q = 'SELECT * FROM cms_records
WHERE
fieldsetid = "' . $_POST['fieldsetid'] . '"
ORDER BY sortorder ASC';
$getFinfo_r = mysql_query($getFinfo_q);
$getFinfo_n = mysql_num_rows($getFinfo_r);
$pnum = 1;
$checkPosted = 0;
//START INSERT QUERY BEGINNING WITH USUAL STARTING VALUES
$query_q = 'UPDATE cms_content SET ';
//WHILE LOOP FOR ADDING THE DATABASE VALUES
while ($getFinfo = mysql_fetch_array($getFinfo_r)) {
switch ($getFinfo['type']) {
case "file":
if (isset($_FILES[$_POST['recordset'] . '_' . $getFinfo['db_name']]["name"])) {
$fileInput = rand() . $_FILES[$_POST['recordset'] . '_' . $getFinfo['db_name']]["name"];
if (!file_exists('../uploads/' . $_POST['id'] . '/')) {
mkdir('../uploads/' . $_POST['id'] . '/', 0777);
}
if (!file_exists('../uploads/' . $_POST['id'] . '/' . $getFinfo['db_name'])) {
mkdir('../uploads/' . $_POST['id'] . '/' . $getFinfo['db_name'], 0777);
} else {
foreach (glob('../uploads/' . $_POST['id'] . '/' . $getFinfo['db_name'] . '/*') as $file) {
if (is_dir($file)) {
recursiveRemoveDirectory($file);
} else {
unlink($file);
}
}
}
move_uploaded_file($_FILES[$_POST['recordset'] . '_' . $getFinfo['db_name']]["tmp_name"], '../uploads/' . $_POST['id'] . '/' . $getFinfo['db_name'] . '/' . $filename . '.' . $fileext);
$query_q .= ($pnum > 1 ? ", " : " ") . $getFinfo['db_name'] . '="' . $fileInput . '" ';
$checkPosted++;
}
break;
case "photo":
if (!empty($_FILES[$_POST['recordset'] . '_' . $getFinfo['db_name']]["name"])) {
if (!file_exists('../uploads/' . $_POST['id'] . '/')) {
mkdir('../uploads/' . $_POST['id'] . '/', 0777);
}
if (!file_exists('../uploads/' . $_POST['id'] . '/' . $getFinfo['db_name'])) {
mkdir('../uploads/' . $_POST['id'] . '/' . $getFinfo['db_name'], 0777);
} else {
foreach (glob('../uploads/' . $_POST['id'] . '/' . $getFinfo['db_name'] . '/*') as $file) {
if (is_dir($file)) {
recursiveRemoveDirectory($file);
} else {
unlink($file);
}
}
}
$filename = pathinfo($_FILES[$_POST['recordset'] . '_' . $getFinfo['db_name']]["name"], PATHINFO_FILENAME);
$fileext = strtolower(pathinfo($_FILES[$_POST['recordset'] . '_' . $getFinfo['db_name']]["name"], PATHINFO_EXTENSION));
$filename = strtolower(rand() . $filename);
$img = new abeautifulsite\SimpleImage($_FILES[$_POST['recordset'] . '_' . $getFinfo['db_name']]['tmp_name']);
$img->fit_to_width(300)->save('../uploads/' . $_POST['id'] . '/' . $getFinfo['db_name'] . '/300xauto_' . $filename . '.' . $fileext);
$img->save('../uploads/' . $_POST['id'] . '/' . $getFinfo['db_name'] . '/' . $filename . '.' . $fileext);
move_uploaded_file($_FILES[$_POST['recordset'] . '_' . $getFinfo['db_name']]["tmp_name"], '../uploads/' . $_POST['id'] . '/' . $getFinfo['db_name'] . '/' . $filename . '.' . $fileext);
$query_q .= ($pnum > 1 ? ", " : " ") . $getFinfo['db_name'] . '="' . $filename . '.' . $fileext . '" ';
$checkPosted++;
}
break;
case "html":
$query_q .= ($pnum > 1 ? ", " : " ") . $getFinfo['db_name'] . '="' . addslashes(htmlspecialchars($_POST[$_POST['recordset'] . '_' . $getFinfo['db_name']])) . '" ';
$checkPosted++;
break;
case "yesno":
$query_q .= ($pnum > 1 ? ", " : " ") . $getFinfo['db_name'] . '="' . $_POST[$_POST['recordset'] . '_' . $getFinfo['db_name']] . '" ';
$checkPosted++;
break;
case "multiselect":
case "checkboxes":
$vals = "";
$x = 0;
if (isset($_POST[$_POST['recordset'] . '_' . $getFinfo['db_name']])) {
foreach ($_POST[$_POST['recordset'] . '_' . $getFinfo['db_name']] as $key => $value) {
$x++;
$vals .= $value . ($x < count($_POST[$_POST['recordset'] . '_' . $getFinfo['db_name']]) ? "," : "");
}
$query_q .= ($pnum > 1 ? ", " : " ") . $getFinfo['db_name'] . '="' . $vals . '" ';
$checkPosted++;
}
break;
case "radio":
$vals = "";
$x = 0;
if (!empty($_POST[$_POST['recordset'] . '_' . $getFinfo['db_name']])) {
$query_q .= ($pnum > 1 ? ", " : " ") . $getFinfo['db_name'] . '="' . htmlspecialchars($_POST[$_POST['recordset'] . '_' . $getFinfo['db_name']]) . '" ';
$checkPosted++;
}
break;
case "foreignkey":
$fkeyOptions = $eqApp->get_field_options($getFinfo['options'], $pnum - 1);
if ($fkeyOptions['record_fkeytype'] == "select") {
$query_q .= ($pnum > 1 ? ", " : " ") . $getFinfo['db_name'] . '="' . htmlspecialchars($_POST[$_POST['recordset'] . '_' . $getFinfo['db_name']]) . '" ';
$checkPosted++;
} elseif ($fkeyOptions['record_fkeytype'] == "multiselect") {
//.........这里部分代码省略.........
示例13: array
$active_template = $active_template[0]->id;
$queries->update('templates', $active_template, array('enabled' => 0));
// Make new template active
$queries->update('templates', $template_query, array('enabled' => 1));
// Finally, we need to write to cache
$c->setCache('templatecache');
$c->store('template', htmlspecialchars($template_name));
Session::flash('scan_complete', '<div class="alert alert-success">' . $admin_language['template_enabled'] . '</div>');
echo '<script data-cfasync="false">window.location.replace(\'/admin/styles/?type=templates\');</script>';
die;
} else {
if (isset($_GET['action']) && $_GET['action'] == 'delete' && isset($_GET['type']) && $_GET['type'] == 'templates') {
// Delete template
$item = $_GET['template'];
require 'core/includes/remove_directories.php';
recursiveRemoveDirectory('styles/templates/' . $item);
// Delete from database
$queries->delete('templates', array('name', '=', $item));
Session::flash('templates', '<div class="alert alert-success">' . $admin_language['template_deleted'] . '</div>');
echo '<script data-cfasync="false">window.location.replace(\'/admin/styles/?type=templates\');</script>';
die;
}
}
}
}
}
}
}
}
}
}
示例14: define
// @Email: megaphpdestroyer@gmail.com
if (!isset($_SERVER['HTTP_X_REQUESTED_WITH']) && empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) !== 'xmlhttprequest') die(header('Location: /'));
define("EXEC", true);
require_once ($_SERVER['DOCUMENT_ROOT'] . '/inc/defines.php');
if (!empty($_POST['save'] != '')) {
$ini = $_SERVER['DOCUMENT_ROOT'] . '/config.ini';
file_put_contents($ini, $_POST['config']);
die(json_encode(array('msg' => 'Сохранено')));
}
if (!empty($_POST['reset'] != '')) {
$replace = file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/_config.ini');
$ini = $_SERVER['DOCUMENT_ROOT'] . '/config.ini';
file_put_contents($ini, $replace);
die(json_encode(array('msg' => 'Настройки сброшены')));
}
if (!empty($_POST['remove'] != '')) {
$folder = $_SERVER['DOCUMENT_ROOT'] . '/storage';
foreach (glob("{$folder}/*.zip") as $file) {
if (is_dir($file)) {
recursiveRemoveDirectory($file);
} else unlink($file);
}
die(json_encode(array('msg' => 'Архивы удалены', 'files' => '0')));
}
?>
示例15: check_login
include 'funzioni.php';
include "../mpdf60/mpdf.php";
global $_CONFIG;
$utente = check_login();
if ($utente == -1) {
die("LOGINPROBLEM");
} else {
$user_level = get_user_level($utente);
if ($user_level == 0) {
die("LOGINPROBLEM");
}
if ($user_level == 1) {
die('LOGINPROBLEM');
}
$db = database_connect();
if (!file_exists('./tmp/registrini')) {
mkdir('./tmp/registrini', 0777, true);
chmod("./tmp/registrini", 0777);
} else {
recursiveRemoveDirectory("./tmp/registrini");
}
for ($i = 1; $i <= $_CONFIG["numero_giorni"] * $_CONFIG["ore_per_giorno"]; $i++) {
$result = $db->query("SELECT id from lezioni where ora = '{$i}'") or die($db->error);
while ($idLez = $result->fetch_assoc()) {
generaRegistroOra($idLez["id"], $i);
}
}
Zip("./tmp/registrini/", "./tmp/registrini.zip");
echo "SUCCESS";
}