unlink()与scandir()。 php错误权限被拒绝(文档/。)和(文档/ ..)

时间:2016-07-13 09:53:09

标签: php unlink scandir

在文件夹" scanner ()"是否筛选," unlink ()"我取消注册,如果删除文件夹中的文件,但我收到权限被拒绝错误:

Warning: unlink(path/.): Permission denied in unlink.php on line

Warning: unlink(path/..): Permission denied in unlink.php on line 

我的unlink php代码:

$Pscan = scandir("img/movieData/$m_folder/poster/");
     foreach($Pscan as $Pscan_name){
         unlink("img/movieData/$m_folder/poster/$Pscan_name");    
     }

1 个答案:

答案 0 :(得分:0)

问题已解决:

$Pscan = scandir("img/movieData/$m_folder/poster/");
         foreach($Pscan as $Pscan_name){
             // fixed
             if($Pscan_name == '.' || $Pscan_name == '..'){
                   continue;
             }else{
                   unlink("img/movieData/$m_folder/poster/$Pscan_name");
             }   
         }