I am trying to get the id from the url
My url is: http://localhost/site1/?detail4=31
I am trying to extract only the 31 from the url, so far I have used below:
Code: Select all
<?php
defined('_JEXEC') or die('Restricted Access');
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Router\Route;
$uri = Uri::getInstance();
$uri->toString(array('scheme','host','port','path','query', 'fragment'));
echo "Page URI is: " . $uri->toString() . "<br>";
echo "Scheme: " . $uri->getScheme() . "<br> Host: " . $uri->getHost() . " <br> Path: " . $uri->getPath() ." <br> Query: " . $uri->getQuery() . " <br> Fragment: " . $uri->getVar("NOT SURE WHAT TO PUT HERE") ."<br>";
?>
Page URI is: http://localhost/site1/?detail4=31
Scheme: http
Host: localhost
Path: /site1/
Query: detail4=31
Fragment:
I am not sure what to add in the $uri->getVar("NOT SURE WHAT TO PUT HERE")
Thank you in advance for any assistance,
Craig