Get current page


/ Published in: PHP
Save to your folder(s)

Get current page


Copy this code and paste it in your HTML
  1. function curPageURL() {
  2. $pageURL = 'http';
  3. //if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
  4. $pageURL .= "://";
  5. if ($_SERVER["SERVER_PORT"] != "80") {
  6. $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
  7. } else {
  8. $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
  9. }
  10. return $pageURL;
  11. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.