Author: gnuhpc
Source: http://www.cnblogs.com/gnuhpc/
<> Note: // and # are both single-line annotations.
Variable:
PHP is case sensitive.
Use $ to define variables, and use the reference definition &
Use define to define constants.
Scope:
Define global variables -- global $ variable;
PHP places all the variables in the global [""] array. You can use global ["variable"] to access variables outside the scope.
Static variable -- keep its value.
Variable output:
<? = $ Name?>
Each
Print ($ SS)
Form variables
PHP automatically receives and saves it in environment variables.
$ _ Post [""] variables and $ _ Get [""] process form variables, corresponding to the POST method and method.
Environment Variables and system Constants
Some network request protocols and system configuration information.
Dynamic tables on a web page are generally implemented using auto-increment counting and remainder line feed.
String:. indicates a string connection. It is similar to "+" in Java and "/" is an escape character.
PHP Data Type: it is automatically assigned during definition. Pay attention to it during calculation or conversion. Objects and arrays are available.
File Inclusion:
Require, require_once -- errors are generated and code execution is aborted.
Include, include_once -- generates a warning, and the code will not be aborted.
Function:
Fucntion function name (parameter 1, parameter 2 ,......)
{
Function body code;
Return return value;
}
Array:
Definition:
$ Array_varible = array ();
$ S = array (11,12, 13 );
The key name can be specified, similar to the hash table:
$ S ['Tom '] = 11;
You can also write it as follows:
$ S = array ("Tom => 11 ");
Print: print_r (array_variable );
Traversal: foreach statement
A two-dimensional array consists of multiple one-dimensional arrays.
String:
Print sprintf
Author: gnuhpc
Source: http://www.cnblogs.com/gnuhpc/