Friday, June 5, 2009

Find out absolute path of PHP script, cross platform 100% reliable

Ever had the problem wanting to include a php file 1 from within php file 2 regardless where php file 2 is included from?

$strPath = substr(__FILE__,0,strrpos(__FILE__,DIRECTORY_SEPARATOR)).DIRECTORY_SEPARATOR;

No comments:

Post a Comment