在PHP中获取当前页面的完整URL
这个问题在这里已经有了答案:
您可以使用
$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/42279.html
上一篇: GET current page full URL in php
下一篇: How can I get the full URL in PHP, not just part of it?