Get the complete URL of the current page. What does url mean? The meaning of url is multi-url delivery business 1887

WBOY
Release: 2016-07-29 08:54:03
Original
1689 people have browsed it

Javascript implementation:

top.location.href The address of the top window
this.location.href The address of the current window

PHP implementation:

//Get the domain name or host address
echo $_SERVER[‘HTTP_HOST’].”
”; #localhost

//Get the web page address
echo $_SERVER[‘PHP_SELF’].”
”; #/blog/testurl.php

//Get URL parameters
echo $_SERVER[“QUERY_STRING”].”
”; #id=5

//Get user agent
echo $_SERVER[‘HTTP_REFERER’].”
”;

//Get the complete url
echo 'http://' . [ HTTPHOST ]. _SERVER['REQUEST_URI']; echo 'http://' . [ HTTPH
OST ]. _SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'];//Full url including port number echo 'http://' . [ SERVERNAM E ]

.
: _SERVER[“SERVER_PORT”].$_SERVER ["REQUEST_URI"]; //Get only the pathurl= ht tp://. _SERVER['SERVER_NAME']. S

E


RVER["R EQUE STURI];ec hodi rname(url);').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); }); The above introduces how to get the complete URL of the current page, including the url content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
url
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template