This question already has an answer here:
I have a php script reading a directory like that
if($dossier4 = opendir($_SERVER['DOCUMENT_ROOT'].'/'.$dossierRacine.'/'.$f1.'/'.$f2))
while(false !== ($f3 = readdir($dossier4)))
{
if($f3 != '.'
&& $f3 != '..'
&& $f3 != 'index.php'
&& $f3 != ".DS_Store")
{
?>
{
description: <?php echo '"'.$f3.'"' ; ?>,
children: []
},
<?php
}
}
?>
The script works very well with folders... The problem is when an element is a file that creates an error like this warning opendir(/Users/...)... And that make sens because it's obviously not a directory =))))
Is it possible to create a condition that says
if readdir($folder) is not a folder then ignore
Aucun commentaire:
Enregistrer un commentaire