Tuesday, March 4, 2014

dirname(__FILE__) in PHP




dirnameReturns parent directory's path
 __FILE__   is current file (note is double _), so
dirname(__FILE__) returns directory of current included file.

For example in config.php
require_once(dirname(__FILE__) . '/lib/setup.php');
then /lib/ should be in the same directory as config.php


No comments:

Post a Comment