(PHP 8 >= 8.5.0)
Uri\WhatWg\Url::withPath — Modifie le composant chemin
Crée une nouvelle URL et modifie son composant chemin.
pathL'instance Uri\WhatWg\Url modifiée.
Si l'URL résultante est invalide, une exception Uri\WhatWg\InvalidUrlException est lancée.
Exemple #1 Exemple simple avec Uri\WhatWg\Url::withPath()
<?php
$url = new \Uri\WhatWg\Url("https://example.com/foo/bar");
$url = $url->withPath("/baz");
echo $url->getPath();
?>L'exemple ci-dessus va afficher :
/baz