// Include the PHP Directory Tree class require_once('class.DirectoryTree.php'); // Create a new instance of the class $directoryTree = new DirectoryTree(); // Set the base directory $directoryTree->setBaseDirectory('/path/to/directory'); // Display the folder tree echo $directoryTree->createTree();
// Include the PHP Folder Tree class require_once('class.FolderTree.php'); // Create a new instance of the class $folderTree = new FolderTree('/path/to/folder'); // Set the maximum depth of the folder tree $folderTree->setMaxDepth(3); // Display the folder tree echo $folderTree->getHTML();This code will display the folder tree for the directory `/path/to/folder` with a maximum depth of 3 levels. The PHP Folder Tree class is a lightweight package that provides an easy way to generate a folder tree. It does not require any external libraries or dependencies.