Directory listing using PHP -


<?php  function directory_listing($directory_name) {     if ($handle = opendir($directory_name))      {         while (false !== ($entry = readdir($handle)))          {             if ($entry != "." && $entry != "..")              {                 if(is_dir($entry))                 {                         **//program avoiding block                     echo $entry.'--<br/>';**                   }                 else                 {                     echo $entry.'<br/>';                 }                }         }         closedir($handle);     } }   directory_listing('go');  ?> 

i have directory listing above code. program avoiding mentioned if block.

thanks

foysal

to list directories can use directoryiterator

$iterator = new directoryiterator('pathtoyourdir/'); foreach ($iterator $fileinfo) {     if ($fileinfo->isdir()) {         echo $fileinfo->getfilename() . "\n";     } } 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -