How to get the value with & in the url parameter in php_PHP Tutorial

WBOY
Release: 2016-07-13 10:37:08
Original
975 people have browsed it

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

www.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...
Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!