This article mainly introduced the PHP Super Global Array (superglobals) Introduction, this article explained the outline, the variable scope, the Super Global array and the attention matter and so on content, needs the friend to be possible to refer to under
Overview
Want to do a micro-letter public platform, read the micro-letter official URL access to the sample code, found that there is a problem seems to have been half known, is in the class inside the direct use of $_get. After a careful look at this knowledge, found that the basic knowledge of PHP is not very reliable.
Scope of variables
Referring to the hyper-global array of PHP, we cannot help but say the scope of the variable. The scope of a variable is a concept that must be mastered in any programming language. About the variable scope in PHP, there is no more to say here, you can view the data yourself.
Super Global Array
A hyper-global array is a specially defined array variable in PHP, and is called a hyper-global array because the arrays are accessible anywhere in the script, in any scope, such as functions, classes, files, and so on.
The hyper-global array in PHP includes 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 super global arrays in PHP, where global variables are not directly accessible in the class.
Summarize
In the future, we should pay more attention to the basic knowledge and solve the doubts in my heart.