Home > Blogs, Bookmarks, PhP, Tech, Web > PHP: get absolute path to current folder / directory

PHP: get absolute path to current folder / directory

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’);

  1. No comments yet.
  1. No trackbacks yet.
GoCache - ByREV-Cache v1.0 - live served in : 0.179322 sec (gzip)