Home >Common Problem >What are the built-in objects in php?

What are the built-in objects in php?

尊渡假赌尊渡假赌尊渡假赌
尊渡假赌尊渡假赌尊渡假赌Original
2023-11-08 10:15:071021browse

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.

What are the built-in objects in php?

# 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:

  1. \$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.

  2. \$_SERVER: An array containing information such as header information, path and script location. The items in this array are created by the web server.

  3. \$_GET: Array of variables passed to the current script via URL parameters.

  4. \$_POST: Array of variables passed to the current script via the HTTP POST method.

  5. \$_FILES: Array of files uploaded via HTTP POST method.

  6. \$_COOKIE: Array of variables passed to the current script via HTTP Cookies.

  7. \$_SESSION: Array of variables in the current session.

  8. \$_REQUEST: used to collect data submitted by HTML forms.

  9. \$_ENV: Array of variables in the current environment.

  10. \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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn