Introduction to PHP session processing related functions

Source: Internet
Author: User
Tags php session
PHP Handling Session Functions 1 , Session_Start

function function: Start a session or return a session that already exists.

function Prototypes: 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 put this function first, and there can be no output before it, otherwise it will alarm, such as:warning:cannot send session cache limiter – Headers already sent (output started at/usr/local/apache/htdocs/cga/member/1.php:2) in/usr/local/apache/htdocs/cga/ member/1.php on line 3

PHP Handling Session Functions 2 , Session_register

function function: Register a new variable as a session variable

function Prototypes: boolean Session_register (string name);

Return value: A Boolean value.

function Description: This function adds a variable in the global variable to the current SESSION , the Parameters name is the name of the variable you want to add, and the logical value is returned . true . You can use $_session[name] or $HTTP _session_vars[name] to take the form of a value or assignment.

PHP Handling Session Functions 3 , session_is_registered

function function: Check if the variable is registered as a session variable.

function Prototypes: Boobean session_is_registered (string name);

Return Value: Boolean value

function Description: This function can check the current Session whether a specified variable has been registered, the parameter name is the variable name to check. Success returns the logical value true.

PHP Handling Session Functions 4 , Session_unregister

function function: Delete the registered variable.

function Prototypes: boolean Session_session_unregister (string name);

Return Value: Boolean value

function Description: This function is in the current Session Delete the variables in the global variable. The parameter name is the name of the variable you want to delete, and success returns true.

PHP Handling Session Functions 5 , Session_destroy

function function: Ends the current session and empties all resources in the session.

function Prototypes: Boolean session destroy (void);

Return value: A Boolean value.

function Description: This function ends the current Session , this function has no parameters and the return value is true .

PHP Handling Session Functions 6 , Session_encode

function Function: sesssion Information Encoding

function Prototypes: 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 representing variables a the value " It is a test the length is A use semicolons between variables " ; "separated.

PHP Handling Session Functions 7 , Session_decode

function Function: sesssion Information decoding

function Prototypes: Boolean Session_decode (string data)

Return Value: Boolean value

function Description: This function can be used to Session message decoding, Success returns logical value true .

PHP Handling Session Functions 8 , Session_name

function function: Access the current session name

function Prototypes: boolean session_name (string [name]);

return value: String

function Description: This function can get or reset the current Session 's name. If no parameter name is given, the current session name is obtained, plus the parameter indicates that the session The name is set to the parameter name.

PHP Handling Session Functions 9 , session_id

function function: Access the current session identification number

function Prototypes: boolean session_id (string [id]);

return value: String

function Description: This function can be used to get or reset the current storage Session 's identification number. The absence of a parameter ID means that only the ID of the current session is obtained , plus the parameter indicates that the session 's identification number is set to the newly specified ID .

PHP Handling Session Functions Ten , Session_unset

function function: Delete all registered variables.

function Prototypes: void Session_unset (void)

Return Value: Boolean value

function Description: This function and Session_destroy different, it does not end the session. It's like using the function session_unregister to unregister all session variables individually.

Free pick up LAMP brother Lian Original PHP Tutorials CD / the About PHP "Essentials Edition, details of the consultation website customer service: http://www.lampbrother.net

Phpcms Two-time development http://yun.itxdl.cn/online/phpcms/index.php?u=5

Development http://yun.itxdl.cn/online/weixin/index.php?u=5

Mobile Internet server-side development http://yun.itxdl.cn/online/server/index.php?u=5

Javascript Courses http://yun.itxdl.cn/online/js/index.php?u=5

CTO Training Camp http://yun.itxdl.cn/online/cto/index.php?u=5

The above describes the PHP session processing related functions introduced, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Contact Us

    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.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.