2021年3月8日星期一

unlink function is not working correctly in PHP

I make temp folder for saving jpeg files which I create.

After I create these files and upload to S3 , I tried to delete files in temp folder.

but the only last one exists and deleted at next create.

I don't know why last file exists.

$tempPath = "./temp";          $deleteDir = opendir($tempPath);          debug("###  del start!!!!!");          while($file = readdir($deleteDir)) {              $fileInfo = pathinfo($file);              $fileExt = $fileInfo['extension'];              if ($fileExt == "jpeg") {                  @unlink("$tempPath/$file");                  echo "$tempPath/$file";              }          }          closedir($deleteDir);  
https://stackoverflow.com/questions/66540461/unlink-function-is-not-working-correctly-in-php March 09, 2021 at 11:39AM

没有评论:

发表评论