php Method to get the value that is present in the url parameter

  • 2021-01-25 07:18:20
  • OfStack

In fact, in the course of a project, we often encounter a path to get the address of the previous page. You can go back to the previous page
 
<script>window.history.go(-1);</script> 

This is done through JS

If there is a scenario where the user needs to log out, you want him to log out and go back to the current page

The address of the current page, for example, http: / / xxx module php? module=groupbook & view=index & id=2.

You exit the system will use $_SERVER [' REQUEST_URI] to obtain the current path, and then pass this value as a parameter to exit the path of the need to return, this time you back to find

He only got http: / / xxx module php? module=groupbook is not obtained & view=index & id=2, which means that when we exit, the address we return becomes

http://xxx/module.php? module = groupbook (this should be a http: / / xxx module php? module=groupbook & view=index & id = 2),

That's because he took & As a parameter of the first one, it simply means

http://xxx/login.php?op=logout & return=http://xxx/module.php?module=groupbook & view=index & id=2,

Turned out to be

http://xxx/login.php?op=logout & return=http://xxx/module.php?module=groupbook & view=index & id = 2.

$_SERVER[' REQUEST_URI '] $_SERVER[' REQUEST_URI'] $_SERVER['REQUEST_URI']

We can solve our problems

Related articles: