Home >Common Problem >What are the built-in objects in php?
php built-in objects include "\$GLOBALS", "\$_SERVER", "\$_GET", "\$_POST", "\$_FILES", "\$_COOKIE", "\$_SESSION" ", "\$_REQUEST", "\$_ENV" and "\this" ten types: 1. \$GLOBALS, an associative array of global variables; 2. \$_SERVER, including header information, path and script location, etc. Arrays of information and so on.
# Operating system for this tutorial: Windows 10 system, Dell G3 computer.
In PHP, there are many built-in objects that can be used directly in scripts, including but not limited to the following:
\$GLOBALS: Associative array of global variables . This array is accessible from anywhere in the PHP script and is used to access variables in the global scope.
\$_SERVER: An array containing information such as header information, path and script location. The items in this array are created by the web server.
\$_GET: Array of variables passed to the current script via URL parameters.
\$_POST: Array of variables passed to the current script via the HTTP POST method.
\$_FILES: Array of files uploaded via HTTP POST method.
\$_COOKIE: Array of variables passed to the current script via HTTP Cookies.
\$_SESSION: Array of variables in the current session.
\$_REQUEST: used to collect data submitted by HTML forms.
\$_ENV: Array of variables in the current environment.
\this: In an object method, \this points to the object on which the method is called.
These built-in objects provide PHP developers with convenient tools for handling input, accessing environment variables, managing sessions, and other common tasks. By using these built-in objects, developers can write PHP scripts more efficiently.
The above is the detailed content of What are the built-in objects in php?. For more information, please follow other related articles on the PHP Chinese website!