Ever wonder how to include all php files in directory? I just created PHP snippets that may be useful for you. Here is the code:
The contents of include.php:<?php define('MYBASEPATH' , 'inc/'); foreach (glob(MYBASEPATH . '*.php') as $file) { if($file != 'index.php') { include($file); } } ?>
The code above will include all files in directory inc except index.php. To include all files, simply include include.php file on your script.
<?php include( 'include.php' ); ?>
Enjoy :-)
No comments :
Post a Comment