PHP has a super global variable $globals that is not used by many people. The rational use of this variable can make the work more efficient, this article mainly analyzes the use of the Super global variable and the difference between $globals and
This article brings the content is about PHP commonly used magic constants and super-global variables, a simple summary, there is a certain reference value, there is a need for friends to refer to, I hope you have some help.
First, Common Magic
Super global variables in PHP. The Super global variable in PHP starts from PHP4.2.0, and the default value of register_globals is off. as a result, many variables that can be directly used in the past can be used, for example, $ PHP_SELF or the
The Super global variable in PHP starts from PHP4.2.0, and the default value of register_globals is off. as a result, many variables that can be directly used in the past can be used, for example, $ PHP_SELF or the SESSION variable you set cannot be
Many predefined variables in PHP are "Super global", which means they are available in all scopes of a script. You can access functions or methods without performing global $ variable.
These super global variables are:
$ GLOBALS
$ _ SERVER
$ _
The hyper-global variables introduced in PHP 4.1.0 are built-in variables that are always available in all scopes.
PHP Global Variables-Super global variables
Many of the predefined variables in PHP are "hyper-global", which means they are
Today to continue to php9 a series of super-global variables, today to talk about the use of $_file.
First of all, similar to $_post and so on, $_files applies to the upload file class input tag, $_fifles similar to a two-dimensional array, you can
PHP super global variable list
$ _ Get [] Get the variable array submitted using the get Method
$ _ Post [] Get the variable array submitted using the POST method
$ _ Cookie [] obtain and set the cookie ID of the current website
$ _ Session []
PHP has a super global variable $globals that is not used by many people. The rational use of this variable can make the work more efficient, this article mainly analyzes the use of the Super global variable and the difference between $globals and
Use the $_post Super global variable to receive the data from the form, and then use echo to output to the page.
Here's the code:
using super global variable $_post receive form
"/>
name:
The output uses POST to submit the
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
We created two files on Linux with Touch php_get.html php_get.php.
The code for the php_get.html file is as follows:
Super global variable $_get to receive the submitted data and then return the information
Submit data using Get
1. assign values to variables after they are declared. There are two ways to assign values: value assignment and reference assignment. 1. value assignment $ color & quot; red & quot; $ sum12 + & quot; 15 & quot; * $ sum
I. variable assignment
You
PHP super global variable
$ GLOBALSContains a reference to a variable that is valid globally for each current script. The key of the array is the name of the global variable. $ GLOBALS array exists from PHP 3.
$ _ SERVERVariables are set by the Web
Today, we will continue with the php9 series of super global variables. Today we will talk about $ _ FILE usage.
First of all, like $ _ POST, $ _ FILES applies to the input tag of the file upload class. $ _ records les is similar to a
PHPHeader(' content-type:text/html; Charset=utf-8 ');$t 1=Microtime(true);//record that the script just started to run the timestampEcho"Returns the file name of the current execution script. ".$_server[' Php_self ']. " "; Echo"Returns the version
I. Variable assignmentYou can assign values to variables after they are declared. There are two methods: value assignment and reference assignment.1. Value assignment$ Color = "red ";$ Sum = 12 + "15";/* $ sum = 27 */2. If you want two variables to
Super global variable $ globals in the php Tutorial: contains a reference variable that is valid globally for each current script. The key of the array is the name of the global variable. $ Globals array exists from php 3.$ _ Server: variables are
1PHP2 /**3 * PHP Get path or directory implementation4 * @link http://www.phpddt.com5 */6 7 //Magic variable to get the absolute path of the current file8 Echo"__FILE__: ========>".__file__; 9 Echo' ';Ten One
There are many hyper-global variables in PHP, which means they are available in all scopes of a script. There is no need to perform a global $variable in a function or method; You can access them.These hyper-global variables are:
$GLOBALS
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.