Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 906 Vote(s) - 3.55 Average
  • 1
  • 2
  • 3
  • 4
  • 5
what is the difference between $_SERVER['REQUEST_URI'] and $_GET['q']?

#1
what is the difference between `$_SERVER['REQUEST_URI']` and `$_GET['q']` (which is used in Drupal)?
Reply

#2
Given this example url:

[To see links please register here]


`$_SERVER['REQUEST_URI']` will give you:

`/some-dir/yourpage.php?q=bogus&n=10`

Whereas `$_GET['q']` will give you:

`bogus`

In other words, `$_SERVER['REQUEST_URI']` will hold the full request path including the [querystring][1]. And `$_GET['q']` will give you the value of parameter `q` in the querystring.


[1]:

[To see links please register here]

Reply

#3
The PHP manual explains both quite well:

[To see links please register here]

# REQUEST_URI

[To see links please register here]

# for the $_GET["q"] variable
Reply

#4
In the context of Drupal, the difference will depend whether clean URLs are on or not.

With them off, `$_SERVER['REQUEST_URI']` will have the full path of the page as called w/ `/index.php`, while `$_GET["q"]` will just have what is assigned to `q`.

With them on, they will be nearly identical w/o other arguments, but `$_GET["q"]` will be missing the leading `/`. Take a look towards the end of the default .htaccess to see what is going on. They will also differ if additional arguments are passed into the page, eg when a pager is active.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through