Include JUST files in scandir array?

前端 未结 6 2017
刺人心
刺人心 2020-12-05 14:19

I have an array I\'m getting back from scandir, but it contains \".\" and \"..\" and I don\'t want it to.

My code:

$indir =         


        
6条回答
  •  伪装坚强ぢ
    2020-12-05 14:58

    simply use preg_replace to remove all kind of hidden's file from directory

    $files = array(".", "..", "html", ".~html", "shtml");    
    $newfiles = preg_grep('/^([^.])/', scandir($files));
    

提交回复
热议问题