Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Request.php

function Request::getPathInfo

Returns the path being requested relative to the executed script.

The path info always starts with a /.

Suppose this request is instantiated from /mysite on localhost:

  • http://localhost/mysite returns an empty string
  • http://localhost/mysite/about returns '/about'
  • http://localhost/mysite/enco%20ded returns '/enco%20ded'
  • http://localhost/mysite/about?var=1 returns '/about'

Return value

string The raw path (i.e. not urldecoded)

2 calls to Request::getPathInfo()
Request::getRelativeUriForPath in vendor/symfony/http-foundation/Request.php
Returns the path as relative reference from the current Request path.
Request::getUri in vendor/symfony/http-foundation/Request.php
Generates a normalized URI (URL) for the Request.

File

vendor/symfony/http-foundation/Request.php, line 796

Class

Request
Request represents an HTTP request.

Namespace

Symfony\Component\HttpFoundation

Code

public function getPathInfo() : string {
    return $this->pathInfo ??= $this->preparePathInfo();
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal