PHP functions $ _ SERVER

Source: Internet
Author: User
$ _ SERVER http://a.liao1.com/sherry/auto/test.php for PHP functions

// Obtain the domain name or host address
Echo $ _ SERVER ['http _ host']."
"; // A.liao1.com


// Obtain the webpage address
Echo $ _ SERVER ['php _ SELF ']."
"; // Sherry/auto/test. php


// Obtain URL parameters
// Echo $ _ SERVER ["QUERY_STRING"]."
";


// Detailed address of the source webpage
// Echo $ _ SERVER ['http _ referer']."
";
Echo SITE_ROOT ."
"; // Http://a.liao1.com/sherry/auto

Echo $ _ SERVER ["SERVER_NAME"]; // a.liao1.com

?>

$ _ SERVER ["HTTP_USER_AGENT"] get the client browser model

Difference between the getenv ("REMOTE_ADDR") function and $ _ SERVER ['remote _ ADDR '] function

Function for retrieving the IP address of a visitor (client)

The getenv ("REMOTE_ADDR") function can get the IP address normally under apache, but it does not work at all in iis,

$ _ SERVER ['remote _ ADDR '] function, which can be used to obtain the visitor's IP address in apache, and is also valid in iis.

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.