I'm making a file explorer with php but I have to put the file in each folder to be able to access it with my index. how can I make it dynamic or recursive and be able to enter with the same file index?
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>M07</title>
</head>
<body>
    <?php
        $contingut = "";
        if($handle = opendir('.')){
            while (false !== ($file = readdir($handle))){
                if (($file != ".") && ($file != "..") && ($file != "index.php") && ($file != "desktop.ini")){
                    $contingut .= '<a id="enllaç" href="'.$file.'">'.$file.'</a><br><br>';
                }
            }
            closedir($handle);
        }
?>
<?php echo $contingut ?>
 
     
    