PHP Scandir returns extra periods

前端 未结 4 432
深忆病人
深忆病人 2021-01-15 07:53

So I am trying to build a script that scans a directory and returns random images to be used as backgrounds.

The php looks like this:

$dir = \"views         


        
4条回答
  •  囚心锁ツ
    2021-01-15 08:25

    $dh = opendir("c:\");
    while (false !== ($filename = readdir($dh))) {
        if ($filename != '.' && $filename != '..')    
           $files[] = $filename;
    }
    

提交回复
热议问题