Question and answer is powered by AnsPress.io
I am a new comer in php. So please help me to get the full url of the current page using php.
You can try this code.
<?php echo (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; ?>
Here if your site is in http or https no problem will occur. You can get the correct url.