I am trying to understand why this simple task is not going on, and it's time to see me Is it possible to find someone else who I am missing this function is a fairly simple snippet of code that will search again through a directory, it belongs to children, and this is children's children and so on Loading from and in PHP files are required to run the application.
As always, any guidance and assistance is appreciated. Thank you.
Code
Global $ _ MWC; $ _MWC = array (); // Create an empty array to overwrite previously used data $ _MWC ['base'] = dynamism (__ file__); // Equal to "/ base" // Create a function that will load the required PHP files to run the application repeatedly. Function required_A_function ($ dir) {global $ _MWC; $ Scan = globe ($ _ MWC ['base']. '/'. $ Dir. '/ *'); Foreign currency ($ path $ scan as path) {If (preg_match ('/ .php $ /', $ path)) {require_once $ path; } Otherwise (is_dir ($ path)) {require_all_functions ($ path); }}} // Allows to load all the files in the editing directory for use in the system. Require_all_functions ('addon'); Print_r (get_included_files ()); // only for testing
Output
array ([0] => / base / addons / a .php)
file structure
/base/addons/a.php/base/addons/se1/b. Php / base / addons / sub1 / sub2 / c.php
Example:
function glob_recursive ($ pattern) {$ files = glob ($ pattern, $ flags); $ / ($ Dir) as '/ *', GLOB_ONLYDIR | GLOB_NOSORT) $ $ files = array_merge ($ files, glob_recursive ($ dir. '/' .BusName (pattern $ pattern); foreach (glob (dirname ($ pattern).} $ Files;} $ PhpFiles = glob_recursive ($ _McC ['Base']. '/'. $ Dir. '/*.php'); Foreign Exchange ($ phpFiles as phpFile) {require_once $ phpFile;}
No comments:
Post a Comment