我正在使用此功能,它工作正常,但唯一的问题是,如果文件夹为空,它会删除根文件夹。
如果所有项目都已使用之前的cron删除,然后再次调用它,那么它将删除forder字。任何帮助都会很棒
rrmdir('/path/word');
function rrmdir($dir)
{
if (is_dir($dir))
{
$objects = scandir($dir);
foreach ($objects as $object)
{
if ($object != "." && $object != "..")
{
if (filetype($dir."/".$object) == "dir") rrmdir($dir."/".$object);
if (filemtime($dir."/".$object) <= time()-60*60*24) @unlink($dir."/".$object);
}
}
reset($objects);
rmdir($dir);
}
}
答案 0 :(得分:0)
困难在于它取决于来电者的意图。他们应该传入一个目录,如果是这样 - 它应该删除这个目录。由于例程被称为// Code goes here
var app = angular.module('app', []);
app.controller('FirstCtrl', function($scope) {
$scope.data=[
{
"name" : "Tiger Nixon",
"system" : "System Architect"
},
{
"name" : "Tiger Nixon",
"system" : "System Architect"
},
{
"name" : "Tiger Nixon",
"system" : "System Architect"
},
{
"name" : "Tiger Nixon",
"system" : "System Architect"
},
{
"name" : "Tiger Nixon",
"system" : "System Architect"
}
];
$scope.value = 10;
$scope.postvalue = function(value){
console.log(value);
};
});
,我希望它能够删除我传入的目录。
<html ng-app="app" ng-cloak>
<head>
<style>
[ng\:cloak],
[ng-cloak],
[data-ng-cloak],
[x-ng-cloak],
.ng-cloak,
.x-ng-cloak {
display: none !important;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="script.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body ng-controller="FirstCtrl as vm">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Name
<th>System
</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="n in data">
<td style="word-break:break-all;">{{n.name}}</td>
<td style="width:35px;">{{n.system}}</td>
<td>
<input class="form-control input-sm" type="number" name="input" ng-model="value" min="0" max="100" style="width:55px;">
</td>
<td>
<button ng-click="postvalue(value)">Value</button>
</td>
</tr>
</tbody>
</table>
</body>
</html>
我已将rrmdir
移动到子目录的测试中。它之前删除了所有目录(包括传入的目录)。