php global variables include "$_SERVER", "$_GET", "$_POST", "$_FILES", "$_COOKIE", "$_SESSION" and "$_REQUEST". 1. "$_SERVER" is an associative array containing the server and environment information for the current PHP script running; 2. "$_GET" is an associative array containing all parameters sent to the current script through the GET method; 3. " $_POST" and so on.
The operating environment of this tutorial: windows10 system, php8.1.3 version, DELL G3 computer.
PHP is a widely used server-side scripting language used to develop dynamic websites and applications. in PHP , there are some special variables called global variables (SuperGlobals) that can be accessed and used throughout the code. These global variables provide a lot of useful information and functions to facilitate the developer's work. In this article we will discuss Some global variables in PHP.
1. $_SERVER
$_SERVER variable is a variable containing the server and the current PHP An associative array of environment information for the script to run in. It contains information such as the request method (GET, POST, etc.), the file path of the script, and the IP of the server. Address and other information. This information is useful for processing user requests and generating dynamic content.
2. The $_GET
$_GET variable is an associative array containing all parameters sent to the current script via the GET method. GET request takes parameters as URL is sent as part of the array, so these parameters can be accessed and processed through this array. $_GET["parameter_name"] will return the value of the specified parameter.
3. The $_POST
$_POST variable is an associative array containing all parameters sent to the current script via the POST method. POST request takes parameters as HTTP is sent as part of the message, so these parameters do not appear in the URL. $_POST["parameter_name"] will return the value of the specified parameter.
4. The $_FILES
$_FILES variable is an associative array containing all files uploaded to the current script via the POST method. For file upload forms, $_FILES["file_name"] Will contain information about the file such as file name, temporary file path, etc.
5. $_COOKIE
$_COOKIE variable is an associative array containing all cookies sent to the current script via HTTP cookies. cookies It is a small text file that the server sets in the client browser to store user preferences, session information, etc. These can be accessed and processed via $_COOKIE["cookie_name"] cookies.
6. The $_SESSION
$_SESSION variable is an associative array containing all session variables stored in the current session. Session variables are variables that are stored and accessed continuously between different pages. Using $_SESSION Variables, the session must be started using the session_start() function.
7. $_REQUEST
$_REQUEST variable is an associative array containing all parameters sent to the current script through the GET or POST method. It combines $_GET, $_POST and The value in the $_COOKIE array, so you can use this variable to get any type of parameter.
These are some global variables commonly used in PHP, which provide convenient ways to access and handle user requests and environmental information. Understanding and skillfully using these variables allows developers to be more efficient and flexible PHP Programming .
The above is the detailed content of What are the global variables in php. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Atom editor mac version download
The most popular open source editor

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Zend Studio 13.0.1
Powerful PHP integrated development environment

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function
