search

Home  >  Q&A  >  body text

I just started learning, can someone please give me an answer?

To implement folder traversal output, it is required to use red for folders and blue for files, and to have hierarchical indentation with four spaces,

function myscandir($dir){

//Judge whether the path is valid

//is_dir($dir) or die('Currently is not a directory');

echo $dir,'< /br>';

if (is_dir($dir)) {

# code...

echo ' '.' '.' ';

$files = scandir($dir);

foreach ($files as $file) {


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

echo ' '.' '.' ';

myscandir($file);

}

}

}

How to write this code?


大大大云大大大云2217 days ago928

reply all(0)I'll reply

No reply
  • Cancelreply