|
|
Predefined Variables
PHP offers a number of predefined variables, which are set by the system and can provide useful information to your script. Here, we briefly explain some of the more useful ones. A full list is available in the PHP documentation.
$_SERVER
The $_SERVER variable is an array containing a number of elements that provide information about the server running the script, the client, and the connection. Some of these elements are explained below. Note that, depending on the environment in which the script is running (operating system, web server, etc.), not all elements may be available, so you should not rely on them unless you know your particular server environment will always provide them.
$_GET and $_POST
These variables contain information sent by the user's web browser using the HTTP GET and POST methods respectively. See the tutorial on handling user input for examples of how to use these in a script.
$_FILES
The $_FILES array contains details of any files uploaded by the user. Our handling uploaded files tutorial covers the use of this variable.
$_COOKIE
$_COOKIE is an array which contains any relevant cookies sent by the user's web browser. See the cookies tutorial for more details.
Page Responses
Currently there have been no responses to this page...
If you have anything to contribute to this tutorial, found a bug, or know a better way of achieving the same goal, please leave your response below.
|