A simple example to demonstrate access to form variables in PHP
First, write the form page orderform.html, and use the Post method to request the server-side script file:processorder.php
Orderform.html:
Order PageJason's Shopping list
ObjectiveOriginally wanted to update PHP operation socket code, but because of the project reason is not in the mood, but over time will operate SMS Gateway, then naturally update the socket code, today is mainly how to use PHP Exchange two
PHP Magic Variable Summary php, there are a lot of good magic variables, with good, can do less, the following summary:1 _line_Displays the number of lines in the current code:echo "This was line number:". __line__;2 _file_Displays the path of the
Const
Used to define constant values that cannot be changed at run time. Once defined and cannot change its value, an error occurs if the value is changed in the program.
The code is as follows
Copy Code
CALSS
The difference between static and normal variables in PHP
Adding static to the front of a variable constitutes a statically variable
The difference between a static variable and a normal variable is that the scope of a non-static global variable
Everyone in the front-end group: let us put down our work and have new demands. The big counter on the homepage of our website is the one that counts the downloads of user software. The product manager looked at it and thought it needed some special
First, let's look at an example:
The code is as follows
Copy Code
$a = "Hello Springload";$b = $a;Unset ($b);echo $a; Hello Springload?>
This is clear to us, unset ($b), just disconnected the variable name and
This article gives an example of how PHP obtains system variables. Share to everyone for your reference. Specifically as follows:
Here are some PHP built-in functions to get a variety of system variables.
?
1 2 3 4 5 6 7 8 9
$v =
Static variables exist only in the scope of the function, the static variable only exists in the stack, the next time the function is called, the value of the variable will be preservedStatic variables exist only within the scope of a function, and
The first method: $varname =null
Second method: Unset ($varname)
Both of these methods can delete variables, but the results are slightly different.
Code:
Copy Code code as follows:
$a = Array (
' A ' => ' a ',
' B ' => ' B '
);
$b =
Task 2: Recognize the scope of variables
⚑ local variables and global variables
The existence of a variable has its lifecycle, and we can make it exist within a small function, or it can exist throughout the program. For variables declared in
A variable is saved by using a Get variable since PHP4.1.0, and the variables for the http_get_vars are mainly derived from the following methods
For example, a URL that uses the method of a form to obtain information about the server for instance,
Like most structured programs, there are so-called global variables and local variables, and PHP has the same approach in this respect.
When a PHP program executes, the system retains a region of the global variable in memory. In practical use, you
1. IssetFunction: To determine whether a variable is initializedDescription: It does not determine whether the variable is empty and can be used to determine whether the elements in the array have been definedNote: When using isset to determine
Use of references:
Precede a variable with & and assign it to another variable, which is the reference assignment of the variable
code Example:
";
echo $b;
echo "-----------------";
$b = & $a; The reference to the variable
echo
This article mainly introduces the usage of several predefined variables $ _ SERVER in php. the instance summarizes common usage of the predefined variable $ _ SERVER on the SERVER, you can refer to the examples in this article to summarize the
Local variables can be divided into dynamic and static storage types. Local variables in the function. if they are not specifically declared as static storage classes, they are dynamically allocated by default. The internal dynamic variables are
In any development language, some variables are called system variables or environment variables. For more information, see.
PHP environment variables include $ GLOBALS [], $ _ SERVER [], $ _ GET [], $ _ POST [], $ _ COOKIE [], $ _ FILES [], $ _ ENV
1. What is session?It is equivalent to an access to the server from a client (which can be a browser, app, ftp, and other clients, and several more clients can be opened in the same browser, during this period, the server creates a unique identifier
1. isset function: determines whether a variable is initialized.
Note: It does not determine whether the variable is null and can be used to determine whether the elements in the array have been defined.Note: When isset is used to determine whether
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.