Jump to content

Directory scan snippet problem


DarkRanger

Recommended Posts

Hi hi,

 

CAn anyone tell me why this piece of code doesn't work?

 

<?php
function readDirs($main){
	$dirHandle = opendir($main);
	while($file = readdir($dirHandle)){
	if(is_dir($file) && $file != '.' && $file != '..'){
		   readDirs($file);
		}
		else{
		  echo $file . '<br/>';
		}
	} 
}

$dir = '../../lib';

readDirs($dir);
?>

 

It must show all the files in the directory, but only shows:

.
..
technical

Link to comment
https://forums.phpfreaks.com/topic/236930-directory-scan-snippet-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.