-1

How can I return the path of the current page including whats after ?

So for example I am this link

localhost/site1/index.php?view=10&user=5

I want to return this value "index.php?view=10&user=5"

How can I do that using PHP?

I thought $_SERVER['SCRIPT_NAME'] do this but SCRIPT_NAME is returing index.php

Mia Clarke
  • 8,134
  • 3
  • 49
  • 62
Jaylen
  • 39,043
  • 40
  • 128
  • 221

1 Answers1

3

$_SERVER['QUERY_STRING']

and

$_SERVER['REQUEST_URI']

request uri will give you full uri, you can manipulate it to get the last path

as @Mathieu Imbert said, get curious. Inspect everything $_SERVER gives you either by var_dump or by reading documentation i linked to in a comment

dm03514
  • 54,664
  • 18
  • 108
  • 145