php8.5
Home/ Manual/ rfc3986 / uri/ Uri\Rfc3986\Uri::getPath

Uri\Rfc3986\Uri::getPath

PHP function Edit on GitHub ✎

(PHP 8 >= 8.5.0)

Retrieve the normalized path component

Description

Uri\Rfc3986\Uri::getPath(): string

Retrieves the normalized path component.

Parameters Parameters

Return Values

Returns the normalized path component as a String.

Examples

Uri\Rfc3986\Uri::getPath basic example

php
<?php
$uri = new \Uri\Rfc3986\Uri("https://example.com/foo/bar");

echo $uri->getPath();
?>

The above example will output:

output
/foo/bar

See Also

  • Uri\Rfc3986\Uri::getRawPath
  • Uri\Rfc3986\Uri::withPath
  • Uri\WhatWg\Url::getPath

Source: reference/uri/uri/rfc3986/uri/getpath.xml · from the official PHP manual (php/doc-en)