Thursday, October 30, 2014

Get current link or url including parameters in php

The code below shows how to get the current url or link and the parameters of a page.
for example we can get http://sample.com/?id=1&name=juan exactly the same. This is very useful in anchor with links
 
echo 'http://'. $_SERVER[HTTP_HOST] . $_SERVER['REQUEST_URI'];

No comments:

Post a Comment