Uri\WhatWg\Url::getFragment
PHP Manual
PHP Manual»Uri\WhatWg\Url»Uri\WhatWg\Url::getFragment

Uri\WhatWg\Url::getFragment

(PHP 8 >= 8.5.0)

Uri\WhatWg\Url::getFragmentRécupère le composant fragment

Description

public function Uri\WhatWg\Url::getFragment(): ?string

Récupère le composant fragment.

Liste de paramètres

Cette fonction ne contient aucun paramètre.

Valeurs de retour

Retourne le composant fragment sous forme de string si le composant fragment existe, null est retourné sinon.

Exemples

Exemple #1 Exemple simple avec Uri\WhatWg\Url::getFragment()

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

echo $url->getFragment();
?>

L'exemple ci-dessus va afficher :

foo

Voir aussi

To Top