簡體   English   中英

使用php取消鏈接功能刪除臨時文件時Permisson拒絕錯誤

[英]Permisson denied error while deleting a temporary files using php unlink function

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 */

是Web服務器溫度還是系統溫度?

嘗試使用chown()設置文件的權限chown($ fullFilePath,465); //插入一個無效的UserId以設置為Nobody Owner; 例如465 //然后嘗試取消鏈接文件

如果不起作用,請嘗試執行chmod($ fullFilePath,0666)

請參考這里

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM