function base_path

Returns the base URL path (i.e., directory) of the Drupal installation.

base_path() adds a "/" to the beginning and end of the returned path if the path is not empty. At the very least, this will return "/".

Examples:

34 calls to base_path()
color_scheme_form_submit in drupal/core/modules/color/color.module
Form submission handler for color_scheme_form().
ContextualDynamicContextTest::testDifferentPermissions in drupal/core/modules/contextual/lib/Drupal/contextual/Tests/ContextualDynamicContextTest.php
Tests contextual links with different permissions.
DisplayBlockTest::testBlockContextualLinks in drupal/core/modules/block/lib/Drupal/block/Tests/Views/DisplayBlockTest.php
Tests the contextual links on a Views block.
DisplayTest::testPageContextualLinks in drupal/core/modules/views_ui/lib/Drupal/views_ui/Tests/DisplayTest.php
Tests contextual links on Views page displays.
drupal_add_js in drupal/core/includes/common.inc
Adds a JavaScript file, setting, or inline code to the page.

... See full list

File

drupal/core/includes/common.inc, line 1619
Common functions that many Drupal modules will need to reference.

Code

function base_path() {
  return $GLOBALS['base_path'];
}