Some predefined variables in php $ _ SERVER usage summary

Source: Internet
Author: User
This article mainly introduces the usage of several predefined variables $ _ SERVER in php. the instance summarizes common usage of the predefined variable $ _ SERVER on the SERVER, you can refer to the examples in this article to summarize the usage of several predefined variables $ _ SERVER in php. Share it with you for your reference. The details are as follows:

The code is as follows:

<? Php
Echo 'documentroot: '. $ _ SERVER ['document _ root'].'
'; // Root directory, defined in the apache configuration file: httpd. conf for example: DocumentRoot "D:/work/php_root"
Echo 'httphost: '. $ _ SERVER ['http _ host'].'
'; // Domain name, such as localhost
Echo 'phpself: '. $ _ SERVER ['php _ SELF'].'
'; // Path from the root directory to the file itself
Echo 'script filename'. $ _ SERVER ['script _ filename'].'
'; // Documentroot + phpself
Echo 'request uri '. $ _ SERVER ['request _ URI'].'
'; // All URL strings starting from the root directory, including characters after the Question Mark
Echo 'request method: '. $ _ SERVER ['request _ method'].'
'; // Request method
Echo 'name: '. $ _ REQUEST ['name'].'
'; // The value of the request parameter
?>

I hope this article will help you with PHP programming.

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.