List all files in a directory ,extra information is coming

前端 未结 2 799
野的像风
野的像风 2021-01-25 23:07

here my code-

if ($handle = opendir(\'banner/\')) {    
    while (false !== ($file = readdir($handle))) { 
        echo \"$file\"; 
    }     
    closedir($han         


        
2条回答
  •  旧时难觅i
    2021-01-25 23:52

    Because . is the current directory and .. is the parent directory.

    They are always exists.

    If you need to exclude them - just add

    if ($file != '.' && $file != '..')
    

    right before echo

提交回复
热议问题