Uri\WhatWg\Url::getPath

(PHP 8 >= 8.5.0)

Uri\WhatWg\Url::getPathRetrieve the path component

说明

public Uri\WhatWg\Url::getPath(): string

Retrieves the path component.

参数

此函数没有参数。

返回值

Returns the path component as a string.

示例

示例 #1 Uri\WhatWg\Url::getPath() basic example

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

echo
$url->getPath();
?>

以上示例会输出:

/foo/bar

参见