PHP pre-defined variable $_server

Source: Internet
Author: User

PHP pre-defined variable $_server

  $_server is an array that contains such things as the head (headers), Path (paths), and script location (scripts locations). The entity of the array is created by the Web server, and there is no guarantee that all the servers will produce all the information. Here are some common things to do:

The absolute path to the current script, and the absolute path to my local index.php script is: f:/phpstudy/www/test/index.php.

$_server[' script_filename '] = f:/phpstudy/www/test/index.php

The document root directory where the currently running script is located, as defined in the server configuration file:

$_server[' document_root '] = f:/phpstudy/www/test

Name of the server host where the script is currently running (domain name):

$_server[' server_name '] = www.test.com

Host name of the request (domain name):

$_server[' http_host '] = www.test.com

IP address of server host:

$_server[' server_addr '] = 127.0.0.1

Port number of the server host:

$_server[' server_port '] = 80

The request method for accessing the page, which is currently get mode:

$_server[' request_method '] = = GET

Browse the user host IP address of the current page:

$_server[' remote_addr '] = 127.0.0.1

Browse current page User host Connection server useful port number:

$_server[' remote_port '] = 61040

The parameter passed by the request, index.php? What's behind:

$_server[' query_string '] = a=90

Timestamp at the start of the request:

$_server[' Request_time ']=> 1488630127

The path to the current script, the URL required to access the page, and the file name of the currently executing script, related to document root:

$_server[' script_name '] =/index.php

$_server[' Request_uri '] =/index.php

$_server[' php_self '] =/index.php

PHP pre-defined variable $_server

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.