PHP Gets the method with & value in URL parameter _php tips

Source: Internet
Author: User
Actually in the course of the project, we often encounter the path to get the previous page address. You can go back to the previous page using
Copy Code code as follows:

<script>window.history.go ( -1);</script>

This is done through JS.

If there is such a scenario, when the user needs to exit the account, you want him to exit directly after returning to the current page

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

You exit the system presumably will use $_server[' Request_uri ' to get the current path, and then the value as a parameter to exit the need to return the path, this time you find

He only acquired Http://xxx/module.php?module=groupbook but did not get &view=index&id=2, which means that the address we returned after we withdrew became

Http://xxx/module.php?module=groupbook (This is supposed to be http://xxx/module.php?module=groupbook&view=index&id=2),

This is because he took & as the first parameter, simply understood as

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

into a

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

This time we need to use the current acquired $_server[' Request_uri ' for transcoding using UrlEncode ($_server[' Request_uri '))

We can solve our problems.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.