In fact, during the project process, we often encounter the path to obtain the address of the previous page. You can return to the previous page using
copy code The code is as follows:
<script>window.history.go(- 1);</script>
This is operated through JS
If such a scenario occurs, when the user needs to log out of the account, you want him to log out directly. Return to the current page
For example, the address of the current page is http://xxx/module.php?module=groupbook&view=index&id=2.
You must use $_SERVER[' to exit the system REQUEST_URI'] to get the current path, and then pass this value as a parameter to the path that needs to be returned when exiting. At this time, you will find that
he only got http://xxx/module.php?module= groupbook did not get &view=index&id=2, which means that the return address after we exit became
http://xxx/module.php?module=groupbook (it should be http://xxx /module.php?module=groupbook&view=index&id=2),
This is because he regards & as the first parameter, which is simply understood as
http://xxx/login .php?op=logout&return=http://xxx/module.php?module=groupbook&view=index&id=2,
became
http://xxx/login.php? op=logout&return=http://xxx/module.php?module=groupbook&view=index&id=2.
At this time we need to transcode the currently obtained $_SERVER['REQUEST_URI'] and use urlencode($_SERVER['REQUEST_URI'])
to solve our problem
http://www.bkjia.com/PHPjc/736796.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/736796.htmlTechArticleIn fact, during the project process, we often encounter the path to obtain the address of the previous page. You can return to the previous page using copy code. The code is as follows: scriptwindow.history.go(-1);/script this...