Home  >  Article  >  Backend Development  >  php gets the url address of the current page

php gets the url address of the current page

WBOY
WBOYOriginal
2016-07-25 08:46:13977browse
  1. // Description: Get the complete URL
  2. function curPageURL()
  3. {
  4. $pageURL = 'http';
  5. if ($_SERVER["HTTPS"] == "on")
  6. {
  7. $pageURL .= "s";
  8. }
  9. $pageURL .= "://";
  10. if ($_SERVER["SERVER_PORT"] != "80")
  11. {
  12. $pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
  13. }
  14. else
  15. {
  16. $pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
  17. }
  18. return $pageURL;
  19. }
  20. ?>
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
Previous article:PHP import cvs to MySqlNext article:PHP import cvs to MySql