@rollin
To run files from every folder in PHP, you can use the glob()
function to retrieve a list of files within each folder, and then loop through the list to include or execute those files.
Here's an example code snippet:
1 2 3 4 5 6 7 8 9 |
$folders = glob('path/to/main/folder/*', GLOB_ONLYDIR); // Get all subfolders within the main folder foreach ($folders as $folder) { $files = glob("$folder/*.php"); // Get all PHP files within each subfolder foreach ($files as $file) { include $file; // Include or execute the PHP file } } |
Replace 'path/to/main/folder'
with the actual path to your main folder. The *
wildcard character is used in the glob()
function to match all subfolders in the main folder.
This code will loop through each subfolder, retrieve all PHP files within each subfolder, and include or execute them.