php gets the url address of the current page

WBOY
Release: 2016-07-25 08:46:13
Original
977 people have browsed it
  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


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!