dirname(__FILE__) VS setting global variable to directories
Posted
by
SAFAD
on Stack Overflow
See other posts from Stack Overflow
or by SAFAD
Published on 2012-06-09T22:30:34Z
Indexed on
2012/06/09
22:40 UTC
Read the original article
Hit count: 235
what are the pros and cons of using this :
$globals['server_url'] = dirname(__FILE__);
$globals['mainfiles'] = dirname(__FILE__).'/main';
and the pros and cons of using this :
$globals['server_url'] = '/srv/www/htdocs/somwhere/';
$globals['mainfiles'] = '/srv/www/htdocs/somwhere/main';
And what do you suggest.
by the way: these are set in config.php file which is called by other files as well, to stop directory conflicts when including files we use it like this :
require_once($globals['server_url'].'/test.php');
© Stack Overflow or respective owner