GET current page full URL in php
This question already has an answer here:
您可以使用
$current_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
尝试这个:
if (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) || isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
$protocol = 'https://';
}
else {
$protocol = 'http://';
}
$current_link = $protocol.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
echo $current_link;
链接地址: http://www.djcxy.com/p/42280.html
上一篇: 如何从PHP中的URL获取网站名称?
下一篇: 在PHP中获取当前页面的完整URL