PHP gets current page URL

WBOY
Release: 2016-07-25 08:42:47
Original
901 people have browsed it

This PHP snippet can help you let users jump directly to the page they visited before after logging in

  1. function current_url()
  2. {
  3. $url = "http://" . $_SERVER['HTTP_HOST'] . $ _SERVER['REQUEST_URI'];
  4. $validURL = str_replace("&", "&", $url);
  5. return validURL;
  6. }
Copy code

Usage:

  1. echo "Currently you are on: ".current_url();
  2. ?>
Copy code

PHP, URL


Related labels:
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