In PHP we want to get the current page full URL address need to use a few common PHP global variables function, mainly with $_server[] These variables, I will show you a get the current page full URL address program bar.
First look at some
$_server['
PHP gets the current full URL address of the function, PHP gets the current URL
Here is mainly to share a very useful PHP function, the code is very simple, there is no more nonsense, the small partners need to use the words directly.
Copy the Code
This article introduces, with PHP to get the full URL of the current page of a piece of code, very simple, very practical, there is a need for a friend reference.In PHP, all the information is contained in the hyper-global variable $_server. With
PHP/** * JavaScript implementation: * Top.location.href the address of the top-level window * This.location.href The address of the current window*///PHP implementation//Test URL: http://localhost/blog/testurl.php?id=5//Get domain name or host
This article introduces, with PHP and JS implementation of the current page to obtain the full URL of the method, two examples for everyone to learn the reference.1,javascript implementation gets the address This.location.href the current window of
JavaScript implementations:
Top.location.href the address of the top-level windowThis.location.href the address of the current window
PHP Implementation:
Get domain name or host addressecho $_server[' Http_host ']. "”; #localhost
Get web
JavaScript implementations:Top.location.href The address of the top-level windowThis.location.href The address of the current windowPHP implementation#Test URL: http://localhost/blog/testurl.php?id=5Get domain name or host addressEcho$_server['
JavaScript implementations:Top.location.href The address of the top-level windowThis.location.href The address of the current windowPHP implementation#Test URL: http://localhost/blog/testurl.php?id=5//get the domain name or host addressEcho
JavaScript implementation: Top. location.href top-level window address this. location.href address of the current window#Test URL: http://localhost/blog/testurl.php?id=5//get the domain name or host addressEcho $_server[' Http_host ']. "
How PHP gets the full URL of the current page and its parameters
?
echo ' http://'. $_server[' server_name '. ': $_server[' server_port '].$_server[' Request_uri ']. " ";
echo $_server[' server_name ']. " ";//cike.org
echo $_server["Server_port"]
Today opera released the Windows and Mac platform of the opera final web browser, this version is worth saying that the change is aura technology in the adoption of--aura for the browser to provide hardware accelerated rendering; In addition, opera
When using PHP to write a program, we often want to get the URL of the current page. The following provides a function to get the current page URL and how to use it:Example One:
After you define the function, you can call it directly:
JavaScript implementations:Top.location.href the address of the top-level windowThis.location.href the address of the current windowPHP Implementation:#测试网址: http://localhost/blog/testurl.php?id=5echo $_server[' Http_host ']. " ";
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.