Introduction to PHP session processing functions [Part 1]

Source: Internet
Author: User
Introduction to PHP session processing functions [Part 1]

PHP processes session functions 1, session_start

Function: start a session or return an existing session.

Function prototype: boolean session_start (void );

Return value: Boolean

Function description: This function has no parameters and returns true. It is best to place this function first, and there cannot be any output before it, otherwise an alarm will be triggered, 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 processes session functions 2, session_register

Function: registers a new variable as a session variable.

Function prototype: boolean session_register (string name );

Return value: Boolean value.

Function description: This function adds a variable to the current SESSION in the global variable. the parameter name is the name of the variable to be added. if it succeeds, the logical value true is returned. You can use $ _ SESSION [name] or $ HTTP_SESSION_VARS [name] to set values or assign values.

PHP session processing function 3, session_is_registered

Function: checks whether a variable is registered as a session variable.

Function prototype: boobean session_is_registered (string name );

Return value: Boolean

Function description: This function checks whether a specified variable has been registered in the current session. the parameter name is the name of the variable to be checked. If the call succeeds, the logical value true is returned.

PHP processes session functions 4, session_unregister

Function: Delete a registered variable.

Function prototype: boolean session_session_unregister (stringname );

Return value: Boolean

Function description: This function deletes the variables in the global variables in the current session. The parameter name is the name of the variable to be deleted. if it is successful, true is returned.

PHP processes session functions 5 and session_destroy

Function: ends the current session and clears 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 parameters and returns true.


Get free LAMP Brothers original php Tutorial CD/the elaborate PHP Essentials edition, details consulting official website Customer Service: http://www.lampbrother.net

PHPCMS secondary development http://yun.itxdl.cn/online/phpcms/index.php? U = 5

Develop http://yun.itxdl.cn/online/weixin/index.php? U = 5

Mobile internet server development http://yun.itxdl.cn/online/server/index.php? U = 5

Javascript http://yun.itxdl.cn/online/js/index.php course? U = 5

CTO training camp http://yun.itxdl.cn/online/cto/index.php? U = 5


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.