How can i list all files in a directory . I want only the files in root directory.If there is any directory inside the root directory i want to skip those directories and files in them.
Now am using this code
$folderPath = file_directory_path().'/lexalytics/';
if ($handle = opendir($folderPath)) {
$result .= '<div><ul>';
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != "..") {
$result .= "<li><a href=../".$folderPath.$entry.">".$entry."</a>\n</li>";
}
}
$result .= '</ul></div>';
closedir($handle);
}
But it lists subdirectories and files in them.
how can avoid those? Pls help me
Try this code