#测试网址: http:
echo
$_SERVER
[
‘HTTP_HOST‘
].
"<br>"
; #localhost
echo
$_SERVER
[
‘PHP_SELF‘
].
"<br>"
; #/blog/testurl.php
echo
$_SERVER
[
"QUERY_STRING"
].
"<br>"
; #id=5
echo
$_SERVER
[
‘HTTP_REFERER‘
].
"<br>"
;
echo
‘http://‘
.
$_SERVER
[
‘HTTP_HOST‘
].
$_SERVER
[
‘REQUEST_URI‘
];
echo
‘http://‘
.
$_SERVER
[
‘HTTP_HOST‘
].
$_SERVER
[
‘PHP_SELF‘
].
‘?‘
.
$_SERVER
[
‘QUERY_STRING‘
];
#http:
echo
‘http://‘
.
$_SERVER
[
‘SERVER_NAME‘
].
‘:‘
.
$_SERVER
[
"SERVER_PORT"
].
$_SERVER
[
"REQUEST_URI"
];
#http:
$url
=
‘http://‘
.
$_SERVER
[
‘SERVER_NAME‘
].
$_SERVER
[
"REQUEST_URI"
];
echo
dirname(
$url
);
#http: