Home > Backend Development > PHP Tutorial > PHP super global array_PHP tutorial

PHP super global array_PHP tutorial

WBOY
Release: 2016-07-13 09:47:45
Original
894 people have browsed it

PHP Superglobal Array

This article mainly introduces the introduction of PHP superglobals (Superglobals). This article explains the overview, scope of variables, superglobal arrays and precautions For more information, friends who need it can refer to it

Overview

I want to build a WeChat public platform. After reading the sample code for website access provided by WeChat official, I found that there is a problem that seems to be half-understood, which is to use $_GET directly in the class. After carefully checking the knowledge in this area, I found that the basic knowledge of this part of PHP is not very reliable.

Scope of variables

When talking about PHP’s super-global array, we have to talk about the scope of variables. The scope of variables is a concept that exists in any programming language and must be mastered. Regarding the variable scope in PHP, I won’t say more here. You can check the information yourself.

Super global array

Super global arrays are specially defined array variables in PHP. They are called super global arrays because these arrays can be accessed anywhere in the script and in any scope, such as functions, classes, files, etc.

Super global arrays in PHP include the following:

The code is as follows:

$GLOBALS

 $_SERVER

 $_GET

$_POST

 $_REQUEST

 $_COOKIE

 $_SESSION

$_FILES

 $_ENV

Attention

One thing to note is the difference between global variables and superglobal arrays in PHP. Global variables cannot be directly accessed in a class.

Summary

In the future, you should pay more attention to basic knowledge and solve your questions in a timely manner.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1025327.htmlTechArticlePHP Super Global Array This article mainly introduces the introduction of PHP super global array (Superglobals). This article explains the overview, The scope of variables, super-global arrays and precautions, etc., need friends...
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