下面的代码每隔60秒删除文件夹"Images"中的文件,它可以工作,但是当文件夹为空时它会说:警告:为foreach提供的参数无效()如果没有文件,怎么能修复,比如说"文件夹为空而不是该警告..
<?php
$expiretime=1;
$tmpFolder="Images/";
$fileTypes="*.*";
foreach (glob($tmpFolder . $fileTypes) as $Filename) {
// Read file creation time
$FileCreationTime = filectime($Filename);
// Calculate file age in seconds
$FileAge = time() - $FileCreationTime;
// Is the file older than the given time span?
if ($FileAge > ($expiretime * 60)){
// Now do something with the olders files...
echo "The file $Filename is older than $expiretime minutes\r\n";
//delete files:
unlink($Filename);
}
}
?>
Run Code Online (Sandbox Code Playgroud) 我已经下载了 xampp for mac,安装了它并购买了 ssl 证书,但我很难
安装ssl的时间...
搜索了谷歌,但无法理解他们的方式,请花点时间
解释...
从我从xcode 3改为4时,我不断遇到这个语义问题
我的代码没有任何问题,但是当我使用xcode 4时,这种情况仍然存在......
:从不兼容的类型'NSString*'分配给'Main*';
我如何解决它?我试过删除:"self.delegate = [[[NSString alloc] init] autorelease];"
但删除它...不是一个真正的解决方案
-(id)init {
if (self=[super init])
{
self.delegate=[[[NSString alloc] init] autorelease];
}
return self;
}
Run Code Online (Sandbox Code Playgroud)