PHP: get absolute path to current folder / directory
June 14th, 2008
No comments
The simple way :
Use php function getcwd like this:
$base_folder = getcwd();
result in $base_folder is string to current path/folder without end trail, / .
or use php constant called __FILE__
define(’ABSLPATH’, dirname(__FILE__).’/');
where ABSLPATH contains a string with end trail /.
Example for use:
require_once(ABSPATH.’wp-settings.php’);
Categories: Blogs, Bookmarks, PhP, Tech, Web get absolute path, php absolute path, php constant, php dirname, php getcwd, php __FILE__








