ディレクトリの読み方と、そのディレクトリ内のファイルとディレクトリを見つける方法を教えてください。
is_dir()
次の関数を使ってディレクトリをチェックしてみました
$main = "path to the directory";//Directory which is having some files and one directory
readDir($main);
function readDir($main) {
$dirHandle = opendir($main);
while ($file = readdir($dirHandle)) {
if ($file != "." && $file != "..") {
if (is_dir($file)) {
//nothing is coming here
}
}
}
}
しかし、それはディレクトリをチェックしていません。
ありがとう