Note: הוצג ב-4.1.0. בגרסאות קודמות, השתמש ב $HTTP_SERVER_VARS.
$_SERVER הוא מערך המכיל מידע כמו כותרות, נתיבים ומיקומי תוכניות. הערכים במערך זה נוצרים על-ידי השרת. אין ערבות לכך שכל שרת יספק את הערכים הללו; שרתים עלולים להשמיט כמה, או לספק אחרים שלא רשומים כאן. עם זאת, מספר רב מהמשתנים הללו מתוארים ב » מפרט CGI 1.1, כך שתניתן לצפות להם.
זהו משתנה 'סופר-גלובאלי', או גלובאלי אוטומטי. משמע, הוא זמין בכל תחום שהוא בתוך תכנית. אין צורך לעשות global $_SERVER; כדי לגשת אליו בתוך פונקציות או שיטות, כמו ב-$HTTP_SERVER_VARS.
$HTTP_SERVER_VARS מכיל את אותו המידע, אך אינו גלובאלי אוטומטי.
אם ההנחיה register_globals מוגדרת, משתנים אלה יהיו זמינים גם בתחום הגלובאלי של התכנית; משמע, בנפרד מהמערכים $_SERVER ו- $HTTP_SERVER_VARS. למידע רלוונטי, ראה פרק האבטחה ששמו שימוש ב-Register Globals. גלובאלים בודדים אלו אינם גלובאלים אוטומטיים.
אתה עלול למצוא או לא למצוא כל אחד מהאלמנטים הבאים ב-$_SERVER. שים לב שרק כמה, אם בכלל, מהמשתנים הללו יהיו זמינים (ותהיה להם משמעות כלשהי) אם PHP רץ משורת הפקודה.
Note: Introduced in 4.1.0. In earlier versions, use $HTTP_ENV_VARS.
These variables are imported into PHP's global namespace from the environment under which the PHP parser is running. Many are provided by the shell under which PHP is running and different systems are likely running different kinds of shells, a definitive list is impossible. Please see your shell's documentation for a list of defined environment variables.
Other environment variables include the CGI variables, placed there regardless of whether PHP is running as a server module or CGI processor.
This is a 'superglobal', or automatic global, variable. This simply means that it is available in all scopes throughout a script. You don't need to do a global $_ENV; to access it within functions or methods, as you do with $HTTP_ENV_VARS.
$HTTP_ENV_VARS contains the same information, but is not an autoglobal.
If the register_globals directive is set, then these variables will also be made available in the global scope of the script; i.e., separate from the $_ENV and $HTTP_ENV_VARS arrays. For related information, see the security chapter titled Using Register Globals. These individual globals are not autoglobals.
Note: Introduced in 4.1.0. In earlier versions, use $HTTP_GET_VARS.
An associative array of variables passed to the current script via the HTTP GET method. Automatically global in any scope.
This is a 'superglobal', or automatic global, variable. This simply means that it is available in all scopes throughout a script. You don't need to do a global $_GET; to access it within functions or methods, as you do with $HTTP_GET_VARS.
$HTTP_GET_VARS contains the same information, but is not an autoglobal.
If the register_globals directive is set, then these variables will also be made available in the global scope of the script; i.e., separate from the $_GET and $HTTP_GET_VARS arrays. For related information, see the security chapter titled Using Register Globals. These individual globals are not autoglobals.
Note: Introduced in 4.1.0. In earlier versions, use $HTTP_POST_VARS.
An associative array of variables passed to the current script via the HTTP POST method. Automatically global in any scope.
This is a 'superglobal', or automatic global, variable. This simply means that it is available in all scopes throughout a script. You don't need to do a global $_POST; to access it within functions or methods, as you do with $HTTP_POST_VARS.
$HTTP_POST_VARS contains the same information, but is not an autoglobal.
If the register_globals directive is set, then these variables will also be made available in the global scope of the script; i.e., separate from the $_POST and $HTTP_POST_VARS arrays. For related information, see the security chapter titled Using Register Globals. These individual globals are not autoglobals.
Note: Introduced in 4.1.0. In earlier versions, use $HTTP_POST_FILES.
An associative array of items uploaded to the current script via the HTTP POST method. Automatically global in any scope.
This is a 'superglobal', or automatic global, variable. This simply means that it is available in all scopes throughout a script. You don't need to do a global $_FILES; to access it within functions or methods, as you do with $HTTP_POST_FILES.
$HTTP_POST_FILES contains the same information, but is not an autoglobal.
If the register_globals directive is set, then these variables will also be made available in the global scope of the script; i.e., separate from the $_FILES and $HTTP_POST_FILES arrays. For related information, see the security chapter titled Using Register Globals. These individual globals are not autoglobals.
Note: Introduced in 4.1.0. There is no equivalent array in earlier versions.
An associative array consisting of the contents of $_GET, $_POST, $_COOKIE, and $_FILES.
This is a 'superglobal', or automatic global, variable. This simply means that it is available in all scopes throughout a script. You don't need to do a global $_REQUEST; to access it within functions or methods.
If the register_globals directive is set, then these variables will also be made available in the global scope of the script; i.e., separate from the $_REQUEST array. For related information, see the security chapter titled Using Register Globals. These individual globals are not autoglobals.
Note: Introduced in 4.1.0. In earlier versions, use $HTTP_SESSION_VARS.
An associative array containing session variables available to the current script. See the Session functions documentation for more information on how this is used.
This is a 'superglobal', or automatic global, variable. This simply means that it is available in all scopes throughout a script. You don't need to do a global $_SESSION; to access it within functions or methods, as you do with $HTTP_SESSION_VARS.
$HTTP_SESSION_VARS contains the same information, but is not an autoglobal.
If the register_globals directive is set, then these variables will also be made available in the global scope of the script; i.e., separate from the $_SESSION and $HTTP_SESSION_VARS arrays. For related information, see the security chapter titled Using Register Globals. These individual globals are not autoglobals.
Note: $GLOBALS has been available since PHP 3.0.0.
An associative array containing references to all variables which are currently defined in the global scope of the script. The variable names are the keys of the array.
This is a 'superglobal', or automatic global, variable. This simply means that it is available in all scopes throughout a script. You don't need to do a global $GLOBALS; to access it within functions or methods.
$php_errormsg is a variable containing the text of the last error message generated by PHP. This variable will only be available within the scope in which the error occurred, and only if the track_errors configuration option is turned on (it defaults to off).