Overview
Want to be a public platform, read the official URL to access the sample code, found that there is a problem seems to have been half-known, is to use the $_get in the class directly. After a close look at the knowledge of this area, I found that the basic knowledge of this part of PHP is not very reliable.
Scope of the variable
Referring to the hyper-global array of PHP, it is not important to say the scope of the variable. The scope of a variable is a concept in any programming language and must be mastered. About the scope of variables in PHP, there is no more to say, you can view the information on their own.
Hyper-Global Array
A hyper-global array is a specially defined array variable in PHP that is referred to as 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:
Copy the Code code as follows:
$GLOBALS
$_server
$_get
$_post
$_request
$_cookie
$_session
$_files
$_env
Attention
One thing to note is the difference between global variables and hyper-global arrays in PHP, where global variables are not directly accessible in classes.
Summarize
In the future, we should pay more attention to the basic knowledge and solve our doubts in time.