Php obtains the php server variable in the current url path.
Programming in php to obtain the current url address and server variables mainly uses the following global variables: $ _ server ["query_string"], $ _ server ["request_uri"], $ _
$ _ SERVER ['server _ SIGNATURE '] # a string containing the SERVER version and virtual host name. $ _ SERVER ['path _ TRANSLATED '] # Basic PATH of the file system where the current script is located (not the root directory of the document.
$ _
The port used by the server. The default value is "80 ". If you use an SSL secure connection, this value is the HTTP port you set.
For example, I need to obtain the current URL address.
$ Url_this = "http: //". $ _ SERVER ['http _ host']. $ _ SERVER
? Php // Obtain the domain name or HOST address echo $ _ SERVER ['http _ host']. br; // Obtain the webpage address echo $ _ SERVER ['php _ SELF ']. br; // Obtain the url parameter echo $ _ SERVER [QUERY_STRING]. br; // detailed address of the source
Php file contains Chinese garbled characters. Do you know how to parse garbled text into Chinese? & Lt ;? Phpclass & nbsp; database {************************************** * **************** & nbsp; mySQL ???????????? * ****** How to solve the
Use the php file Upload idea and implementation, read the specific idea and implementation of using php file upload. for file upload, we need to use the type = file type of the form in HTML and its enctype attribute. This is what we all need. Of
The parameter concatenation link passed by tag a enables the join query of the parameters passed by tag a to implement the join query, just like the tag tab on the left of www.movie.hao123.com to implement the combined query ., Don't understand...,
PHP to obtain the complete URL of the current page javascript implementation:
Top. location. href top-level window address
This. location. href address of the current window
PHP implementation # test URL: http: // localhost/blog/testurl. php? Id = 5
Php global variables, which are defined by php global variables. Php global variables, php global variables define PHP global variables PHP pre-defines several Super global variables (superglobals), which means that they can use php global variables
Among the many predefined SERVER variables in PHP, $ _ SERVER [REQUEST_URI] is frequently used, but this variable is only supported by apache. therefore, we need a more general method to obtain the value of REQUEST_URI.
Among the many predefined
Help me check whether the code is standard. if statements Judge $ hosturl = $ _ SERVER ['php _ SELF ']; & nbsp; // Obtain the current urlif & nbsp; $ hosturl = "/index. php "& nbsp; // if the URL is equal to/index. php, enter the body field content {
For example, I need to obtain the current URL address.$ Url_this = "http: //". $ _ SERVER ['HTTP _ host']. $ _ SERVER ['php _ SELF '];Echo $ url_this;
Http: // localhost/lu. php
SERVER variable: $ _ SERVERNote: PHP 4.1.0 and later versions are used.
Form attributes
Action
Define a URL. Send data to this URL when you click Submit.
4
5
Data
For automatic data insertion.
5
Replace
Define what is done when a form is submitted.
5
Javascript implementation:
Top. Location. href top-level window addressThis. Location. href address of the current window
PHP implementation
# Test URL: http: // localhost/blog/testurl. php? Id = 5// Obtain the domain name or host
First, PHP retrieves the URL of the current page:
CopyCode The Code is as follows: // obtain the current Script URL
Function getcururl ()
{
If (! Empty ($ _ server ["request_uri"])
{
$ Scriptname = $ _ server ["request_uri"];
$ Nowurl = $
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.