Created
February 24, 2021 01:43
-
-
Save aice09/d26d022746cbd04e95c4061855cc90df to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$genpath = "../fileshere/"; | |
$category = "Folder Test 1"; | |
$folder = scandir($genpath . $category); | |
$files = array_diff($folder, array( | |
'.', | |
'..', | |
'.metadata' | |
)); | |
$a = "<ul>"; | |
foreach ($files as $file) { | |
$a .= "<li>" . $file . "</li>"; | |
if ($file === '.' or $file === '..') { | |
continue; | |
} else { | |
$a .= "<ul>"; | |
$xfolder = scandir($genpath . $category . '/' . $file); | |
$xfiles = array_diff($xfolder, array( | |
'.', | |
'..', | |
'.metadata' | |
)); | |
foreach ($xfiles as $key) { | |
if ($key === '.' or $key === '..') { | |
continue; | |
} else { | |
$a .= "<li>" . $key . "</li>"; | |
} | |
} | |
$a .= "</ul>"; | |
} | |
} | |
$a .= "</ul>"; | |
echo $a; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment