note 93901 deleted from function.include by googleguy

From: Date: Wed, 01 Aug 2012 06:58:39 +0000
Subject: note 93901 deleted from function.include by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-189553@lists.php.net to get a copy of this message
Note Submitter: fkaufusi at gmail dot com ---- here's another way to include your files. <?php function includeFile($file_name){ $dir = array('./', 'lib/', 'db/', 'student/'); //<-- put here your website directory you want to include $level = array('', '/', '../', '../../'); //<-- you can add more deep level in this array $ini_path = array(); foreach($dir as $p){ foreach($level as $l){ $file = $l.$p.$file_name; if(file_exists($file)){ include_once($file); return; } } } } //end function includeFile includeFile('html.php'); includeFile('libpage.php'); ?>

« previous php.notes (#189553) next »