Usage summary of several predefined variables $_SERVER in php, summary of _server
The examples in this article summarize the usage of several predefined variables $_SERVER in PHP. Share it with everyone for your reference. The details are as follows:
Copy code The code is as follows:
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'].'
'; // The 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 the 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 be helpful to everyone’s PHP programming design.
?
echo - - Just~
If you want to see all the variables under $_SERVER
echo "
";
var_dump($_SERVER);
PHP provides a large number of predefined variables. Detailed documentation is not available as many variables depend on the version and settings of the running server, among other factors. Some predefined variables do not take effect when PHP is run from the command line. Commonly used predefined array variables include $_POST, $_GET, $_REQUEST, $_COOKIE, $_SESSION, $_SERVER, etc. For details, you can refer to the PHP manual, which is very clear.
http://www.bkjia.com/PHPjc/907843.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/907843.htmlTechArticlephp several predefined variables $_SERVER usage summary, _server summary This article summarizes several php predefined variables$ Usage of _SERVER. Share it with everyone for your reference. The details are as follows: Copy code...