foreach (new DirectoryIterator($tempFilesPath) as $fileData)
{
$fileName = $fileData->getFileName();
$fullFilePath = $tempFilesPath.$fileName;
$fileExtension = $fileData->getExtension();
{
switch($fileExtension)
case 'csv':unlink($fullFilePath); break;
case 'pdf' :unlink($fullFilePath); break;
case 'html': unlink($fullFilePath); break;
}
}
/* Delete the files from temp directory , Permission denied error is coming */
答案 0 :(得分:0)
是webserver temp还是系统temp?
尝试使用chown()设置文件权限 CHOWN($ fullFilePath,465); //插入无效的UserId以设置为Nobody Owner;例如465 //然后尝试取消链接文件
如果它不起作用尝试 chmod($ fullFilePath,0666)