Home > Backend Development > PHP Problem > How to define super global variables in php

How to define super global variables in php

silencement
Release: 2023-02-25 06:36:02
Original
3591 people have browsed it

How to define super global variables in php

When using global variables in PHP functions, we need to use the global keyword to declare the content used, but if there is no variable declared with the global keyword, we call it a super

Global variables.

Super global variables are variables defined in PHP and cannot be added arbitrarily by users. They mainly store values ​​received from the Web server.

Let’s take a look at the types and formats of superglobal variables

There are currently nine types of superglobal variables in php

$GLOBALS
$_SERVER
$_REQUEST
$_POST
$_GET
$_FILES
$_ENV
$_COOKIE
$_SESSION
Copy after login

These are associative arrays, so they are the same as Use the same for other arrays.

For example, if you access the URL https://server.com/user.php?id=123, use $ _GET $ _GET ["id"], you can get "123".

The above is the detailed content of How to define super global variables in php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template