PHP Get URL
To get the current url of the page in PHP you need to access the $_SERVER globals. This is a quick and easy way to get the current url (whether http or https) to use it inside your application.
$url = (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
About this entry
You’re currently reading “PHP Get URL,” an entry on PHP Functionalism
- Published:
- 1.3.12 / 4pm
- Category:
- Tips & Tricks
- Tags:
No comments
Jump to comment form | comments rss [?] | trackback uri [?]