Home  >  Article  >  Backend Development  >  PHP gets current page URL

PHP gets current page URL

WBOY
WBOYOriginal
2016-07-25 08:42:47898browse

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


Statement:
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