wordpress - How to get the full URL of the current page using PHP -
this question has answer here:
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
Post a Comment