如何获取完整的网址,例如http://www.domain.com/page.php?id=someid&page=1
,而不仅仅是http://www.domain.com/page.php
?
答案 0 :(得分:4)
$_SERVER['QUERY_STRING']
包含URL的查询字符串部分。
答案 1 :(得分:3)
快速回答:
$url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
答案 2 :(得分:1)
$url = (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'].$_SERVER['QUERY_STRING'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'].$_SERVER['QUERY_STRING'];