wordpress - How to get the full URL of the current page using PHP -


what "less code needed" way parameters url query string formatted following?

my current url

www.mysite.com/category/subcategory/#myqueryhash 

i put code

$url="http://".$_server['http_host'].$_server['request_uri']; 

it returns www.mysite.com/category/subcategory/

output should :

www.mysite.com/category/subcategory/#myqueryhash 

you can use http request

<?php $current_url="http://".$_server['http_host'].$_server['request_uri']; ?> 

you can use https request

<?php $current_url="https://".$_server['http_host'].$_server['request_uri']; ?> 

you can use http/https request

<?php $current_url="//".$_server['http_host'].$_server['request_uri']; ?> 

Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -