In PHP development, compared to cookie,session is stored on the server side of the session, relatively safe, and not as a Cookie as the storage length limit, here we detail the PHP processing session function will use 10 functions.
PHP Processing session function 1, session_start
function function: Start a session or return a session that already exists.
Function prototype: Boolean session_start (void);
Return Value: Boolean value
Function Description: This function has no parameters and the return value is true. It is best to place this function first, and there is no output before it, otherwise it will alarm, such as: Warning:cannot send session cache Limiter–headers already sent (output started At/us R/local/apache/htdocs/cga/member/1.php:2) in/usr/local/apache/htdocs/cga/member/1.php on line 3
PHP Processing session function 2, Session_register
function function: Register a new variable as session variable
Function prototype: Boolean Session_register (string name);
Return value: Boolean value.
Function Description: This function is to add a variable in the global variable to the current session, the parameter name is the name of the variable you want to join, and success returns the logical value TRUE. You can use the form of $_session[name] or $http_session_vars[name] to take a value or assign a value.
PHP Processing session function 3, session_is_registered
function function: Checks whether a variable is registered as a session variable.
Function prototype: Boobean session_is_registered (string name);
Return Value: Boolean value
Function Description: This function checks whether the specified variable is registered in the current session, and the parameter name is the variable name to check. Success returns the logical value TRUE.
PHP Processing session function 4, Session_unregister
function function: Deletes a registered variable.
Function prototype: Boolean Session_session_unregister (string name);
Return Value: Boolean value
Function Description: This function deletes the variables in the global variable in the current session. The parameter name is the name of the variable you want to delete, and success returns TRUE.
PHP Processing session function 5, Session_destroy
function function: Ends the current session and empties all resources in the session.
Function Prototype: Boolean session destroy (void);
Return value: Boolean value.
Function Description: This function ends the current session, this function has no arguments, and the return value is true.
PHP Processing session function 6, Session_encode
function function: sesssion information encoding
Function prototype: string session_encode (void);
return value: String
Function Description: The returned string contains the names and values of the variables in the global variable in the form of: A|s:12: "It is a test"; C|s:4: "Lala"; A is the variable name s:12 represents the value of variable a "it is a test length is a semicolon between 12 variables"; Separated.
PHP Processing session function 7, Session_decode
function function: sesssion information decoding
Function prototype: Boolean Session_decode (String data)
Return Value: Boolean value
Function Description: This function can decode session information, success returns the logical value TRUE.
PHP Processing session function 8, Session_name
function function: Accessing the current session name
Function prototype: Boolean session_name (string [name]);
return value: String
Function Description: This function can get or reset the name of the current session. Without the parameter name, the current session name is obtained, plus the parameter indicates that the session name is set to the parameter name.
PHP Processing Session function 9, session_id
function function: Accessing the current session identification number
Function prototype: Boolean session_id (string [id]);
return value: String
Function Description: This function can get or reset the identification number of the current session. The absence of a parameter ID means that only the identification number of the current session is obtained, plus the parameter indicates that the session's identification number is set to the newly specified ID.
PHP processing session function 10, Session_unset
function function: Deletes all registered variables.
Function prototype: void Session_unset (void)
Return Value: Boolean value
Function Description: This function is different from Session_destroy, it does not end the session. Just like using a function session_unregister to log off all of the session variables.